当前位置: 首页>>代码示例>>C#>>正文


C# PictureBox.Refresh方法代码示例

本文整理汇总了C#中System.Windows.Forms.PictureBox.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# PictureBox.Refresh方法的具体用法?C# PictureBox.Refresh怎么用?C# PictureBox.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.PictureBox的用法示例。


在下文中一共展示了PictureBox.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Joueur

        private int totalPoint; // le score du joueur

        #endregion Fields

        #region Constructors

        // constructeur, on recoit le panel, le point de départ dans le panel et si le joueur est le premier ou le deuxieme
        public Joueur(Panel panel, Point loc, bool j1)
        {
            pBJoueur = new PictureBox(); // on instencie le pB du joueur
            pBJoueur.Location = loc;    // on place le joueur a la bonne position dans le panel
            pBJoueur.BackColor = Color.Transparent; // Astuce pour avoir un fond transparent avec un bitmap. La couleur de fond est transparente
            Bitmap vaisseau;
            if (j1)                 // Si c'est le joueur 1 alors il sera blanc. On choisi un pixel ( dans un des coins) dont la couleur correspondra au transparent
            {
                joueur1 = true;     // variable pour les animations (pas avoir de changement de couleurs lors du changement d'image)
                vaisseau = new Bitmap(@".\vaisseau.bmp");
                vaisseau.MakeTransparent((vaisseau.GetPixel(0, vaisseau.Size.Height - 1)));
            }                       // si c'est le joueur 2
            else
            {
                joueur1 = false;
                vaisseau = new Bitmap(@".\vaisseau2.bmp");
                vaisseau.MakeTransparent((vaisseau.GetPixel(0, vaisseau.Size.Height - 1)));
            }
            pBJoueur.Size = new Size(50, 50); // on donne la taille au pB
            pBJoueur.Image = vaisseau; // On donne au pB l'image
            pBJoueur.BringToFront();    // On met le pB au premier plan pour éviter des recouvrements
            this.panelFond = panel;     // On met le panel recu dans une des variables pour éviter de devoir faire des envois intempestifs
            panelFond.Controls.Add(pBJoueur); // on ajoute le joueur au controle du panel (pour qu'on ne voie pas le gros carré noir)
            pBJoueur.Refresh(); // Pour etre certain que l'image est bien présente dans le pB
            totalPoint = 0; // on mets son score a 0
            combo = 1000;   // On rempli sa jauge de super tir
        }
开发者ID:Boucquey,项目名称:projetInfo,代码行数:34,代码来源:Joueur.cs

示例2: DrawProfileBox

 public void DrawProfileBox(PictureBox NPCProfileBox)
 {
     SetProfileBMP(GetProfile());
      NPCProfileBox.Image = GetProfileBMP();
      NPCProfileBox.Show();
      NPCProfileBox.Refresh();
 }
开发者ID:Gabe-Biele,项目名称:Arborea,代码行数:7,代码来源:Character.cs

示例3: CenterPictureBox

 private void CenterPictureBox(PictureBox picBox, Bitmap picImage)
 {
     picBox.Image = picImage;
     picBox.Location = new Point((picBox.Parent.ClientSize.Width / 2) - (picImage.Width / 2),
                                 (picBox.Parent.ClientSize.Height /2) - (picImage.Height / 2));
     picBox.Refresh();
     picBox.Update();
 }
开发者ID:raviroyind,项目名称:eXpressPrint,代码行数:8,代码来源:PrintForm.cs

示例4: updateGUI

 private void updateGUI(PictureBox picBox, Bitmap img)
 {
     picBox.Image = img;
     picBox.Invalidate();
     picBox.Update();
     picBox.Refresh();
     Application.DoEvents();
 }
开发者ID:TarekVito,项目名称:RobotPlanning,代码行数:8,代码来源:StepViewer.cs

示例5: Refresh

 private void Refresh(PictureBox picture, CardSet player, Label placar)
 {
     picture.Image = null;
     if (player.Count > 0)
     {
         picture.Image = player[0].Image;
         picture.Refresh();
     }
   
     placar.Text = player.Count.ToString();
 }
开发者ID:rcarubbi,项目名称:Carubbi.Cards,代码行数:11,代码来源:frmGame.cs

示例6: grfk

        public static void grfk(int w1, int x, int y,  Int64[,] Z)
        {
            int hh = 511;   //260;
            int [] buf=new int[w1];

            int maxx = 0, minx = 0, b=0;
            for (int i = 0; i < w1; i++){  b =  (int) Z[i, y]; if (b < minx) minx = b; if (b > maxx) maxx = b; buf[i] = b;}

            for (int i = 0; i < w1; i++) { buf[i] = (buf[i] - minx) * hh / (maxx - minx); }

            Font font = new Font("Arial", 12, FontStyle.Regular); //, GraphicsUnit.Pixel);
            StringFormat drawFormat = new StringFormat(StringFormatFlags.NoClip);
            string sx = " minx =  " + minx + "  maxx =  " + maxx;

            Form f2 = new Form();
            f2.Size = new Size(w1 + 38,  hh + 92);

            PictureBox pc1 = new PictureBox();
            pc1.BackColor = Color.White;
            pc1.Location = new System.Drawing.Point(0, 8);
            pc1.Size = new Size(w1 + 16, hh + 64);
            pc1.SizeMode = PictureBoxSizeMode.StretchImage;
            pc1.BorderStyle = BorderStyle.Fixed3D;
            Bitmap btmBack = new Bitmap(w1 + 16, hh + 64);      //изображение
            Bitmap btmFront = new Bitmap(w1 + 16, hh + 64);     //фон
            Graphics grBack = Graphics.FromImage(btmBack);
            //Graphics grFront = Graphics.FromImage(btmFront);  //лучше объявить заранее глобально.
            pc1.Image = btmFront;
            pc1.BackgroundImage = btmBack;

            Pen p1 = new Pen(Color.Black, 1);
            Pen p2 = new Pen(Color.Red, 1);
            Pen p3 = new Pen(Color.Green, 1);
            // ------------------------------------------------------------------------------------------------------------График по x

            //  Ось x
            grBack.DrawLine(p1, 8, hh + 9, w1 + 8, hh + 9);
            for (int i = 0; i < w1; i += 8) grBack.DrawLine(p1, i + 8, hh + 1, i + 8, hh + 9);
            grBack.DrawString(sx, font, new SolidBrush(Color.Black), 32, hh + 24, drawFormat);

                //  Ось y
            grBack.DrawLine(p1, 8, 8, 8, hh +8);
            for (int i = 8; i < hh + 8; i += 8) grBack.DrawLine(p1, 8, i, 12, i);

            grBack.DrawLine(p3, x + 8, 0, x + 8, hh + 9);       // Значение координаты

            for (int i = 0; i < w1 - 1; i++) grBack.DrawLine(p2, i + 8, hh - buf[i] + 8, i + 1 + 8, hh - buf[i + 1] + 8);

            pc1.Refresh();

            f2.Controls.Add(pc1);

            f2.Show();
        }
开发者ID:interferometry7,项目名称:interferometry,代码行数:54,代码来源:GraphClass1.cs

示例7: drawrectangle

 public void drawrectangle(PictureBox pb, Point p1, float Bwidth, Color c1)
 {
     //refresh the picture box
     pb.Refresh();
     //create a new bitmap
     Bitmap map = new Bitmap(pictureBox1.Width, pictureBox1.Height);
     //create a graphics object
     Graphics g = Graphics.FromImage(map);
     //create a pen object and setting the color and width for the pen
     Pen p = new Pen(c1, Bwidth);
     //draw line between  point p1 and p2
     g.DrawEllipse(p, (p1.X - 50), (p1.Y - 50), 15, 15);
     pb.Image = map;
     //dispose pen and graphics object
     p.Dispose();
     g.Dispose();
 }
开发者ID:brunoChr,项目名称:visionEstia,代码行数:17,代码来源:Drawing.cs

示例8: DrawAllPictureBoxes

        public void DrawAllPictureBoxes()
        {
            foreach (Item i in nw.GetItemList())
            {
                if (i is Component)
                {
                    var pb = new PictureBox();
                    pb.Name = "picturebox" + pictureBoxes.Count;
                    pb.Location = ((Component)i).GetPoint();
                    pb.Size = new Size(60, 60);
                    pb.BorderStyle = BorderStyle.None;
                    pb.SizeMode = PictureBoxSizeMode.StretchImage;
                    panel2.Controls.Add(pb);

                    if (i is Spliter)
                    {
                        pb.Image = Image.FromFile("../../../images/spliter.png");
                    }
                    else
                        if (i is Sink)
                        {
                            pb.Image = Image.FromFile("../../../images/sink.png");
                        }
                        else
                            if (i is Pump)
                            {
                                pb.Image = Image.FromFile("../../../images/pump.png");
                            }
                            else
                                if (i is Merger)
                                {
                                    pb.Image = Image.FromFile("../../../images/merger.png");
                                }

                    pb.Refresh();
                    pb.MouseDown += new MouseEventHandler(picMouseDown);
                    pb.MouseMove += new MouseEventHandler(picMouseMove);
                    pb.MouseUp += new MouseEventHandler(picMouseUp);
                    pictureBoxes.Add(pb);
                    Invalidate();
                }
            }
        }
开发者ID:xAlexV,项目名称:OOD2,代码行数:43,代码来源:FormNetwork.cs

示例9: MyRect

        /// <summary>
        /// Constructor of class "MyRect", which paints rectangle
        /// </summary>
        /// <param name="id">Unique rectangle's id</param>
        /// <param name="rect">Rectangle's position and size</param>
        /// <param name="pbox">PictureBox, where we paint</param>
        /// <param name="showInHistory">(false - DON'T show object creation in changes history)</param>
        public MyRect(int id, Rectangle rect, PictureBox pbox, Color rColor = default(Color), bool showInHistory = true)
        {
            _rectangle = rect;
            _pictureBox = pbox;
            _sizeOfNode = 6;
            _uniqId = id;

            Random r = new Random();

            _rectColor = rColor.IsEmpty? Color.FromArgb(r.Next(0, 200), r.Next(0, 200), r.Next(0, 200)) : rColor;

            if (showInHistory)
                logger.AddMessage(ActionType.Add, _uniqId, _rectangle, _rectangle, _rectColor);

            // Event bindings
            AddRemovePictureEvents();

            _pictureBox.Refresh();
        }
开发者ID:RichMcLaren,项目名称:RectangleEditor,代码行数:26,代码来源:MyRect.cs

示例10: Enemi

        private int points = 100; // On lui attribue une certaine valeur pour le score

        #endregion Fields

        #region Constructors

        // création, il recoit le panel sur lequel il va apparaitre et aussi si il est utilisé en multijoueur ou pas
        public Enemi(Panel panel, Boolean multi)
        {
            Random rnd = new Random(); // On crée un nombre aléatoire
            enemi = new PictureBox(); // on instancie le pB
            p = new Point(); // on instancie la position
            p.X = panel.Width; // On le met à droite du panel
            p.Y = rnd.Next(0, panel.Height - enemi.Height); // sa hauteur est aléatoire
            Image vaisseau = Image.FromFile(@".\enemi1.png"); // On lui met une image
            enemi.BringToFront(); // On le met au premier plan pour pas qu'il ne soit recouvert par un autre picturebox
            enemi.Image = vaisseau; // on attribue l'image au pB
            enemi.Height = 30; // on donne sa hauteur et largeur a l'enemi
            enemi.Width = 60;
            if (!multi)
            {
                enemi.BackColor = Color.Transparent; // pour éviter des pertes de performance en multijoueur, on laisse le carré noir
            }
            enemi.Location = p; // on le place en p
            panel.Controls.Add(enemi);// On ajoute son controle au panel (redondance)
            lives = 2; // On lui attribue 2 vies
            enemi.Refresh(); // Redondance pour etre sur que son dessin soit mis
        }
开发者ID:Boucquey,项目名称:projetInfo,代码行数:28,代码来源:Enemi.cs

示例11: PlotSingleGaussian

        internal static void PlotSingleGaussian(
			PictureBox pictureBox,
			LCMeasurement reading,
			Brush[] allBrushes,
			double aperture,
			int bpp)
        {
            Bitmap bmp = pictureBox.Image as Bitmap;
            if (bmp != null)
            {
                Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);

                using (Graphics g = Graphics.FromImage(bmp))
                {
                    reading.PsfFit.DrawInternalPoints(g, rect, (float)aperture, allBrushes[reading.TargetNo], bpp);
                    g.Save();
                }
            }

            pictureBox.Refresh();
        }
开发者ID:hpavlov,项目名称:tangra3,代码行数:21,代码来源:frmPSFFits.cs

示例12: EntityButton

        public EntityButton(Entity entity)
        {
            InitializeComponent();

            Entity = entity;
            sprite = entity.MainSprite;

            spritePict = new PictureBox {Height = sprite.Height, Width = sprite.Width};

            BackColor = Color.Transparent;
            Width = spritePict.Width + 8;
            Height = spritePict.Height + 8;
            Controls.Add(spritePict);
            spritePict.Top = 4;
            spritePict.Left = 4;

            spritePict.Image = null; // sprite[0].CutTile;
            spritePict.Refresh();

            Program.AnimateTick += Program_FrameTick;
            spritePict.Click += spritePict_Click;
        }
开发者ID:laazer,项目名称:cs_megaman,代码行数:22,代码来源:EntityButton.cs

示例13: OpenPreviewWindow

        public static void OpenPreviewWindow(ref PictureBox pictureBox)
        {
            int Height = (int)pictureBox.Height;
            int Width = (int)pictureBox.Width;

            hHwnd = capCreateCaptureWindowA(Device.ToString(), WS_VISIBLE | WS_CHILD, 0, 0, 640, 480, pictureBox.Handle.ToInt32(), 0);

            // Connect to webcam
            if (SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, Device, 0) != 0) { // 0 == false
                SendMessage(hHwnd, WM_CAP_SET_SCALE, 1, 0);
                SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, PREVIEW_RATE, 0);
                //Start previewing the image from the camera
                SendMessage(hHwnd, WM_CAP_SET_PREVIEW, 1, 0);
                // Resize window to fit in picturebox
                SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, (int)pictureBox.Width, (int)pictureBox.Height, SWP_NOMOVE | SWP_NOZORDER);

            } else {
                // Error connecting to device, so close window
                DestroyWindow(hHwnd);
                pictureBox.BackColor = System.Drawing.Color.Black;
                pictureBox.Refresh();
            }
        }
开发者ID:mlnlover11,项目名称:IExtendFramework,代码行数:23,代码来源:Webcam.cs

示例14: BoundaryFill4

        // boundary fill cu 4 puncteStiva vecine
        public void BoundaryFill4(int x, int y, Color fill, Color boundary, Bitmap bmp, PictureBox pb)
        {
            Stack<Point> puncteStiva = new Stack<Point>();
            Point punctInitial = new Point(x, y);
            int x1;
            int y1;
            Color crt;

            puncteStiva.Push(punctInitial); // adaugam punctul initial in stiva

            while (puncteStiva.Count > 0)
            {
                Point punctCrt = puncteStiva.Pop(); // scoatem punctul curent din stiva
                x1 = punctCrt.X;
                y1 = punctCrt.Y;

                crt = bmp.GetPixel(x1, y1);

                if (crt.ToArgb() != fill.ToArgb() && crt.ToArgb() != boundary.ToArgb())
                {

                    bmp.SetPixel(x1, y1, fill);

                    puncteStiva.Push(new Point(x1 + 1, y1)); // dreapta
                    puncteStiva.Push(new Point(x1 - 1, y1)); // stanga
                    puncteStiva.Push(new Point(x1, y1 + 1)); // sus
                    puncteStiva.Push(new Point(x1, y1 - 1)); // jos

                    pb.Image = bmp;
                    pb.Refresh();
                }
            }
            // timerBoundary4.Enabled = true;
            //  timerBoundary4.Interval = 1;
            //  timerBoundary4.Tick += timerBoundary4_Tick;
        }
开发者ID:GeorgianaMihaela,项目名称:polygonFilling,代码行数:37,代码来源:BoundaryFill.cs

示例15: BoundaryFill8

        //private void timerBoundary4_Tick(object sender, EventArgs args)
        //{
        //    if (puncteStiva.Count == 0)
        //    {
        //        timerBoundary4.Stop();
        //        timerBoundary4.Enabled = false;
        //    }
        //}
        //  crt = bmp.GetPixel(x, y);
        // asa recursiv da stack overflow
        //if (crt != boundary && crt != fill)
        //{
        //    bmp.SetPixel(x, y, fill);
        //    BoundaryFill4(x + 1, y, fill, boundary, bmp);
        //    BoundaryFill4(x - 1, y, fill, boundary, bmp);
        //    BoundaryFill4(x, y + 1, fill, boundary, bmp);
        //    BoundaryFill4(x, y - 1, fill, boundary, bmp);
        //}
        public void BoundaryFill8(int x, int y, Color fill, Color boundary, Bitmap bmp, PictureBox pb)
        {
            Stack<Point> puncteStiva = new Stack<Point>();
            Point punctIntit = new Point(x, y);
            puncteStiva.Push(punctIntit); // adaugam punctul initial in stiva

            int x1, y1;
            Color crt;

            while (puncteStiva.Count > 0)
            {
                Point punctCrt = puncteStiva.Pop(); // scoatem punctul curent din stiva
                x1 = punctCrt.X;
                y1 = punctCrt.Y;

                crt = bmp.GetPixel(x1, y1);

                if (crt.ToArgb() != boundary.ToArgb() && crt.ToArgb() != fill.ToArgb())
                {
                    bmp.SetPixel(x1, y1, fill);
                    puncteStiva.Push(new Point(x1, y1 + 1)); // nord
                    puncteStiva.Push(new Point(x1 + 1, y1 + 1)); // nord-est
                    puncteStiva.Push(new Point(x1 + 1, y1)); // est
                    puncteStiva.Push(new Point(x1 + 1, y1 - 1)); // sud-est
                    puncteStiva.Push(new Point(x1, y1 - 1)); // sud
                    puncteStiva.Push(new Point(x1 - 1, y1 - 1)); // sud-vest
                    puncteStiva.Push(new Point(x1 - 1, y1)); // vest
                    puncteStiva.Push(new Point(x1 - 1, y1 + 1)); // nord-vest
                }

                pb.Image = bmp;
                pb.Refresh();
            }
            // timerBoundary8.Enabled = true;
            // timerBoundary8.Interval = 1;
            // timerBoundary8.Tick += timerBoundary8_Tick;

            // asa va da stack overflow
            //crt = bmp.GetPixel(x, y);

            //if (crt != boundary && crt != fill)
            //{
            //    bmp.SetPixel(x, y, fill);
            //    BoundaryFill8(x + 1, y, fill, boundary, bmp);
            //    BoundaryFill8(x + 1, y + 1, fill, boundary, bmp);
            //    BoundaryFill8(x, y + 1, fill, boundary, bmp);
            //    BoundaryFill8(x - 1, y + 1, fill, boundary, bmp);
            //    BoundaryFill8(x - 1, y, fill, boundary, bmp);
            //    BoundaryFill8(x - 1, y - 1, fill, boundary, bmp);
            //    BoundaryFill8(x, y - 1, fill, boundary, bmp);
            //    BoundaryFill8(x + 1, y - 1, fill, boundary, bmp);
            //}
        }
开发者ID:GeorgianaMihaela,项目名称:polygonFilling,代码行数:71,代码来源:BoundaryFill.cs


注:本文中的System.Windows.Forms.PictureBox.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。