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


C# PictureBox.Invoke方法代码示例

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


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

示例1: DisplayPicture

 public void DisplayPicture(Bitmap img, PictureBox picBox)
 {
     picBox.Invoke(new EventHandler(delegate
     {
         picBox.Image = img;
     }));
 }
开发者ID:ThuTrangK57,项目名称:sigateWsan,代码行数:7,代码来源:ShowData.cs

示例2: setPicture

 public void setPicture(PictureBox box, Image pic)
 {
     if (box.InvokeRequired)
     {
         try { box.Invoke(new PictureBoxDelegate(setPicture), new Object[] { box, pic }); }
         catch { }
     }
     else
         box.Image = pic;
 }
开发者ID:DutchSoldier,项目名称:FHSICT,代码行数:10,代码来源:Form1.cs

示例3: UpdateImage

 public static void UpdateImage(PictureBox i_PictoreBox, Image i_Image)
 {
     if (i_PictoreBox.InvokeRequired)
     {
         i_PictoreBox.Invoke(new Action<PictureBox, Image>(UpdateImage), i_PictoreBox, i_Image);
     }
     else
     {
         i_PictoreBox.Image = i_Image;
     }
 }
开发者ID:rajeshwarn,项目名称:dp_ex4,代码行数:11,代码来源:Utils.cs

示例4: MoveDog

        private void MoveDog(PictureBox pcb)
        {
            while (!((pcb.Location.X) >= (pcbPistaCorrida.Width - pcb.Width)))
            {
                int distance = MyRandom.Next(4);
                Point p = pcb.Location;
                p.X += distance;

                pcb.Invoke(() => pcb.Location = p);
                pcbPistaCorrida.Invoke(() => pcbPistaCorrida.Refresh());
                Thread.Sleep(30);

            }

            TheWinnerDog(pcb);
        }
开发者ID:luisflv,项目名称:SistemasDistribuidos,代码行数:16,代码来源:Form1.cs

示例5: updatePictureBox

 private void updatePictureBox(PictureBox pic, Image value)
 {
     if (pic.InvokeRequired)
     { pic.Invoke(new picDelegate(updatePictureBox), new object[] { pic, value }); }
     else
     {
         pic.BackgroundImage = value;
     }
 }
开发者ID:keithloughnane,项目名称:Omnipresent,代码行数:9,代码来源:Client.cs

示例6: setPictureBox

 private void setPictureBox(PictureBox control, bool visible)
 {
     if (control.InvokeRequired)
     {
         control.Invoke(new MethodInvoker(delegate
         {
             control.Visible = visible;
         }));
     }
     else
     {
         control.Visible = visible;
     }
 }
开发者ID:oofdui,项目名称:ContactCheckup-MassConvert,代码行数:14,代码来源:frmConvertPayorByRegisterDate.cs

示例7: SetImage

 // set Image
 private void SetImage(PictureBox pic, string text)
 {
     if (pic.InvokeRequired)
     {
         pic.Invoke(new MethodInvoker(delegate { SetImage(pic, text); }));
         return;
     }
     pic.Image = Image.FromFile(text);
 }
开发者ID:nhatkycon,项目名称:bxvinh,代码行数:10,代码来源:Form1.cs

示例8: setImage

 private void setImage(PictureBox pcx, Bitmap map)
 {
     if (pcx.InvokeRequired)
     {
         pcx.Invoke(new setImageHandler(setImage), pcx, map);
     }
     else
     {
         pcx.Image = map;
     }
 }
开发者ID:fanjunwei,项目名称:My12306ForDotNet,代码行数:11,代码来源:Form1.cs

示例9: SetPictureBoxImage

 public static void SetPictureBoxImage(PictureBox control, Image image)
 {
     if (control.InvokeRequired)
         control.Invoke(new SetPictureBoxImageDelegate(SetPictureBoxImage), new object[] { control, image });
     else
         control.Image = image;
 }
开发者ID:CustomerFX,项目名称:SalesLogixGitExtensions,代码行数:7,代码来源:ControlHelper.cs

示例10: reload

 //Load ban do
 public void reload(PictureBox pic)
 {
     pic.Invoke(new EventHandler(delegate
     {
         try
         {
             Database myDatabase = new Database();
             Bitmap image = new Bitmap(path);
             gr.DrawImage(image, 0, 0);
             XmlNodeList node = (myDatabase.xml).GetElementsByTagName("node");
             foreach (XmlNode nodechild in node)
             {
                 string mac = nodechild.Attributes["mac"].Value;
                 if (mac == "00" || mac[0] == 'B')
                 {
                     DrawActor(mac);
                 }
                 else
                 {
                     DrawSensor(mac);
                 }
             }
             XmlNodeList val = (myDatabase.xml).GetElementsByTagName("val");
             foreach (XmlNode valchild in val)
             {
                 int id = Int32.Parse(valchild.Attributes["id"].Value);
                 DrawVan(id);
             }
             // pictureBox.Image = bit;
             //pictureBox.Refresh();
             pic.Image = bit;
         }
         catch
         {
             //DisplayData("Khong the load anh", tb);
         }
     }));
 }
开发者ID:WSAN-Lab411,项目名称:Embedded_Computer_Gateway,代码行数:39,代码来源:libDraw.cs

示例11: updatePictureBox

 private void updatePictureBox(PictureBox p, ref System.Drawing.Bitmap bmp)
 {
     if (p.IsDisposed == false)
     {
         if (p.InvokeRequired)
         {
             try
             {
                 p.Invoke(new updatePictureBoxCallback(updatePictureBox), p, bmp);
             }
             catch (Exception ex) { }
         }
         else
         {
             p.Image = bmp;
             p.Refresh();
         }
     }
 }
开发者ID:daiiniel,项目名称:ThermoCamApp,代码行数:19,代码来源:CamControl.cs

示例12: Render

        public void Render(Bitmap img, Dictionary<int, List<int>> xDic, int xLength, int yLength, PictureBox pictureBox1, PictureBox pictureBox2, string shapeName)
        {
            try
            {
                var g = default(Graphics);
                var g2 = default(Graphics);
                //var imageSq = new List<MosaicTile>();
                var newImg = new Bitmap(xLength * tileSize.Width, yLength * tileSize.Height);
                var pb2Img = new Bitmap(xLength * tileSize.Width, yLength * tileSize.Height);
                //var saveImg = new Bitmap(colorMap.GetLength(0) * tileSize.Width, colorMap.GetLength(1) * tileSize.Height);
                //var file = Graphics.FromImage(saveImg);
                var rand = new Random();

                pictureBox1.Invoke(new MethodInvoker(() =>
                {
                    pictureBox1.Image = newImg;
                    pictureBox2.Image = pb2Img;

                    g = Graphics.FromImage(pictureBox1.Image);

                    g2 = Graphics.FromImage(pictureBox2.Image);

                }));

                var b = new SolidBrush(Color.Black);
                g.FillRectangle(b, 0, 0, img.Width, img.Height);
                g2.FillRectangle(b, 0, 0, img.Width, img.Height);
                //file.FillRectangle(b, 0, 0, img.Width, img.Height);

                Rectangle destRect, srcRect;

                foreach (var xItem in xDic)
                {
                    foreach (var yItem in xItem.Value)
                    {
                        int x = xItem.Key;
                        int y = yItem;

                        string[] files = Directory.GetFiles(ConfigurationSettings.AppSettings["DownloadImagesFolderPath"])
                            .Where(file => !file.ToLower().Contains("processed"))
                            .ToArray();

                        string path = string.Empty;
                        if (files.Length > 0)
                        {
                            path = files[0];
                        }
                        else
                        {
                            var processedList = Directory.GetFiles(ConfigurationSettings.AppSettings["DownloadImagesFolderPath"])
                            .Where(file => file.ToLower().Contains("processed")).ToArray();
                            path = processedList[rand.Next(processedList.Length)];
                        }

                        using (Image source = Image.FromFile(path))
                        {
                            //imageSq.Add(new MosaicTile()
                            //{
                            //    X = x,
                            //    Y = y,
                            //    Image = path
                            //});

                            srcRect = new Rectangle(0, 0, source.Width, source.Height);

                            for (int i = 1; i < 15; )
                            {
                                pictureBox2.Invoke(new MethodInvoker(() =>
                                {
                                    pictureBox2.Image = PictureBoxZoom(source, new Size(i, i));
                                    int xloc = ((x * tileSize.Width));
                                    int yloc = ((y * tileSize.Width));
                                    if (xloc < 0)
                                        xloc = 0;
                                    if (yloc < 0)
                                        yloc = 0;

                                    pictureBox2.Location = new Point(xloc, yloc);
                                    pictureBox2.Refresh();

                                }));

                                Thread.Sleep(400 / i);
                                i += i;
                            }

                            destRect = new Rectangle(x * tileSize.Width, y * tileSize.Height, tileSize.Width, tileSize.Height);

                            g.DrawImage(source, destRect, srcRect, GraphicsUnit.Pixel);
                            //file.DrawImage(source, destRect, srcRect, GraphicsUnit.Pixel);

                            pictureBox1.Invoke(new MethodInvoker(() =>
                            {
                                pictureBox1.Refresh();
                            }));
                        }

                        if (files.Length > 0)
                        {
                            //File.Delete(path);
//.........这里部分代码省略.........
开发者ID:piyushkp,项目名称:MosaicPhotoViewer,代码行数:101,代码来源:ImageProcessing.cs

示例13: UpdatePbOriginalImage

 private void UpdatePbOriginalImage(PictureBox pb, Image img)
 {
     if (pb.InvokeRequired)
     {
         // This is a worker thread so delegate the task.
         pb.Invoke(new UpdatePbOriginalImageDelegate(this.UpdatePbOriginalImage), pb, img);
     }
     else
     {
         // This is the UI thread so perform the task.
         pbOriginal.Image = img;
     }
 }
开发者ID:7ASecond-Net,项目名称:Imogen,代码行数:13,代码来源:FrmProfileImage.cs

示例14: updatePictureBox

 private void updatePictureBox(Bitmap x, PictureBox l)
 {
     if (l.InvokeRequired)
     {
         // this is worker thread
         updatePictureBoxDelegate del = new updatePictureBoxDelegate(updatePictureBox);
         l.Invoke(del, new object[] { x, l });
     }
     else
     {
         // this is UI thread
         l.Image = x;
     }
 }
开发者ID:tyrelsouza-archive,项目名称:TorchTester2,代码行数:14,代码来源:startForm.cs

示例15: show

 /// <summary>
 /// This method demonstrates a pattern for making thread-safe
 /// calls on a Windows Forms control. 
 ///
 /// If the calling thread is different from the thread that
 /// created the UserControl object's, this method creates a
 /// SetLocationCallback and calls itself asynchronously using the
 /// Invoke method.
 ///
 /// If the calling thread is the same as the thread that created
 /// the UserControl object's, the Location property is set directly. 
 /// </summary>
 /// <param name="obj">The UserControl object's</param>
 /// <param name="newLocation">Move object to this location</param>
 public void show(PictureBox obj, Point newLocation)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     try
     {
         #region Set Location in Safely
         if (obj.InvokeRequired)
         {
             SetLocationCallback d = new SetLocationCallback(show);
             obj.Invoke(d, new object[] { obj, newLocation });
         }
         else
         {
             // if:
             //    original location = newLocation = (50, 50)
             //    obj.Size = (70, 70)
             // ----------------------------
             // Virtual location in form
             // (15,15)._______
             //        |(50,50)|
             //      70|   .---|---. Original location in form
             //        |   |   |   |
             //        |___|___|   |
             //            |       |
             //            ._______.
             //        <--->
             //          35
             //
             // create virtual location from original location:
             obj.Location = new Point(newLocation.X - (obj.Size.Width / 2),
                                      newLocation.Y - (obj.Size.Height / 2));
         }
         #endregion
     }
     catch { }
 }
开发者ID:Behzadkhosravifar,项目名称:FoxRabbit,代码行数:52,代码来源:MainForm.cs


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