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


C# PictureBox.LoadAsync方法代码示例

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


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

示例1: addToGrid

        private void addToGrid(object sender, AsyncCompletedEventArgs e)
        {
            Gif gif = (Gif)e.UserState;
            Debug.WriteLine(gif.Filename);

            PictureBox picBox = new PictureBox();
            picBox.SizeMode = PictureBoxSizeMode.StretchImage;
            picBox.Height = 200;
            picBox.Width = 200;
            picBox.WaitOnLoad = false;
            picBox.LoadAsync(gif.Filename);
            picBox.Name = gif.Url;
            picBox.Cursor = Cursors.Hand;
            picBox.MouseClick += new MouseEventHandler(
                (object picSender, MouseEventArgs evntArgs) => {
                    PictureBox pic = (PictureBox)picSender;
                    Clipboard.SetText(pic.Name);

                    trayIcon.BalloonTipIcon = ToolTipIcon.Info;
                    trayIcon.BalloonTipTitle = "Heb m!";
                    trayIcon.BalloonTipText = "URL staat in je clipboard!";
                    trayIcon.ShowBalloonTip(1);
                }
            );

            gridImages.Controls.Add(picBox);
        }
开发者ID:janyksteenbeek,项目名称:Giffie,代码行数:27,代码来源:Main.cs

示例2: ContactCardForm_Load

        private void ContactCardForm_Load(object sender, EventArgs e)
        {
            lblDisplayName.Text = card.DisplayName;
            lblSpaceTitle.Text = (card.Space != null) ? card.Space.Title : String.Empty;

            if (String.IsNullOrEmpty(card.DisplayImageUrl))
            {
                picDisplayImage.Visible = false;
            }
            else
            {
                picDisplayImage.LoadAsync(card.DisplayImageUrl);
            }

            if (card.Album != null)
            {
                lnkAlbumName.Text = card.Album.Title;
                int col = 0;
                foreach (ThumbnailImage img in card.Album.Photos)  //Setting the thumbnail pictures.
                {
                    PictureBox lnkPic = new PictureBox();
                    lnkPic.Dock = DockStyle.Fill;
                    lnkPic.Margin = new Padding(6);
                    lnkPic.BorderStyle = BorderStyle.FixedSingle;
                    lnkPic.SizeMode = PictureBoxSizeMode.Zoom;
                    lnkPic.BackColor = Color.White;
                    lnkPic.LoadAsync(img.ThumbnailUrl);

                    tlpnlAlbum.Controls.Add(lnkPic, col, 0);
                    lnkPic.Tag = col;
                    lnkPic.Visible = true;
                    lnkPic.Click += new EventHandler(lnkPic_Click);
                    ttips.SetToolTip(lnkPic, img.ToolTip);
                    col++;
                }
            }
            else
            {
                pnlAlbum.Visible = false;
            }

            if (card.NewPost != null)
            {
                lnkBlogTitle.Text = card.NewPost.Title;
                ttips.SetToolTip(lnkBlogTitle, card.NewPost.Description);
                lnkBlogContent.Text = card.NewPost.Description;
                ttips.SetToolTip(lnkBlogContent, card.NewPost.Description);
            }
            else
            {
                pnlBlog.Visible = false;
            }

            Text = card.DisplayName + "'s ContactCard";
        }
开发者ID:quynh68,项目名称:msnp-sharp,代码行数:55,代码来源:ContactCardForm.cs

示例3: LoadInto

 public void LoadInto(PictureBox picUser, string index, string url)
 {
     if (images.ContainsKey(index))
     {
         picUser.Image = images[index];
         sequence.Enqueue(index);
     }
     else
     {
         lastRequest = index;
         picUser.LoadAsync(url);
     }
 }
开发者ID:benfulton,项目名称:Twarkee,代码行数:13,代码来源:IconCache.cs

示例4: UpdateMainForm

        public static void UpdateMainForm()
        {
            try
            {
                // If our panel for game list not empty
                if (Definitions.Accessors.MainForm.panel_GameList.Controls.Count != 0)
                    // Then clean panel
                    Definitions.Accessors.MainForm.panel_GameList.Controls.Clear();

                // Do a loop for each game in library
                foreach (Definitions.List.GamesList Game in Definitions.List.Game)
                {
                    // Define a new pictureBox for game
                    PictureBox gameDetailBox = new PictureBox();

                    // Set picture mode of pictureBox
                    gameDetailBox.SizeMode = PictureBoxSizeMode.StretchImage;

                    // Set game image size
                    gameDetailBox.Size = new System.Drawing.Size(230, 107);

                    // Load game header image asynchronously
                    gameDetailBox.LoadAsync("https://steamcdn-a.akamaihd.net/steam/apps/" + Game.appID + "/header.jpg");

                    // Set error image in case of couldn't load game header image
                    gameDetailBox.ErrorImage = global::Steam_Library_Manager.Properties.Resources.no_image_available;

                    // Space between pictureBoxes for better looking
                    gameDetailBox.Margin = new System.Windows.Forms.Padding(20);

                    // Set our game details as Tag to pictureBox
                    gameDetailBox.Tag = Game;

                    // On we click to pictureBox (drag & drop event)
                    gameDetailBox.MouseDown += gameDetailBox_MouseDown;

                    // Create a new right click menu (context menu)
                    ContextMenu rightClickMenu = new ContextMenu();

                    // Set our game details to context menu as Tag
                    rightClickMenu.Tag = Game;

                    // Define an event handler
                    EventHandler mouseClick = new EventHandler(gameDetailBox_ContextMenuAction);

                    // Add right click menu items
                    // Game name (appID) // disabled
                    rightClickMenu.MenuItems.Add(Game.appName + " (" + Game.appID.ToString() + ")").Enabled = false;

                    // Game Size on Disk: 124MB // disabled
                    rightClickMenu.MenuItems.Add("Game Size on Disk: " + Functions.FileSystem.FormatBytes(Game.sizeOnDisk)).Enabled = false;

                    // Spacer
                    rightClickMenu.MenuItems.Add("-");

                    // Play
                    rightClickMenu.MenuItems.Add("Play", mouseClick).Name = "rungameid";

                    // Spacer
                    rightClickMenu.MenuItems.Add("-");

                    // Backup (SLM) // disabled
                    rightClickMenu.MenuItems.Add("Backup (SLM)", mouseClick).Enabled = false;

                    // Backup (Steam)
                    rightClickMenu.MenuItems.Add("Backup (Steam)", mouseClick).Name = "backup";

                    // Defrag game files
                    rightClickMenu.MenuItems.Add("Defrag", mouseClick).Name = "defrag";

                    // Validate game files
                    rightClickMenu.MenuItems.Add("Validate Files", mouseClick).Name = "validate";

                    // Spacer
                    rightClickMenu.MenuItems.Add("-");

                    // Check system requirements
                    rightClickMenu.MenuItems.Add("Check System Requirements", mouseClick).Name = "checksysreqs";

                    // Spacer
                    rightClickMenu.MenuItems.Add("-");

                    // View on Store, opens in user browser not steam browser
                    rightClickMenu.MenuItems.Add("View on Store", mouseClick).Name = "Store";

                    // View on Disk, opens in explorer
                    rightClickMenu.MenuItems.Add("View on Disk", mouseClick).Name = "Disk";

                    // Uninstall, via Steam
                    rightClickMenu.MenuItems.Add("Uninstall", mouseClick).Name = "uninstall";

                    // Set our context menu to pictureBox
                    gameDetailBox.ContextMenu = rightClickMenu;

                    // Add our new game pictureBox to panel
                    Definitions.Accessors.MainForm.panel_GameList.Controls.Add(gameDetailBox);
                }
            }
            catch { }
        }
开发者ID:RemiGC,项目名称:Steam-Library-Manager,代码行数:100,代码来源:Games.cs

示例5: LoadAsync

		[Test] // LoadAsync (String)
		public void LoadAsync2_Url_Null ()
		{
			PictureBox pb = new PictureBox ();

			try {
				pb.LoadAsync ((string) null);
				Assert.Fail ("#1");
			} catch (InvalidOperationException ex) {
				// ImageLocation must be set
				Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:15,代码来源:PictureBoxTest.cs

示例6: LoadChannel

        private void LoadChannel(bool force_reload = false)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new DeLoadChannel(LoadChannel), force_reload);
                return;
            }
            bar.Left = this.Width - bar.Width;
            bar.Top = 0;
            bar.Height = this.Height;

            if (youtube_videos == null)
                return;

            int hor_items = 0;
            int ver_items = 0;
            hor_items = (int)Math.Floor(this.Width / (decimal)(item_width + left_margin));
            ver_items = (int)Math.Floor(this.Height / (decimal)(item_heigh + top_margin));
            bar.Maximum = (int)Math.Floor((double)youtube_videos.Count / (double)(hor_items * ver_items));

            if (bar.Value == bar.Maximum)
            {
                btLoadMore.Visible = true;
            }
            else
            {
                btLoadMore.Visible = false;
            }
            main_images = new List<PictureBox>();
            main_titles = new List<TVKLabel>();

            bar.Value = cur_bar;
            if (last_hor_items == hor_items && last_ver_items == ver_items && force_reload == false)
            {
                return;
            }
            last_hor_items = hor_items;
            last_ver_items = ver_items;

            int cC = 0;
            for (int i = 0; i < Controls.Count; i++)
            {
                if (Controls[cC] is TVKingScrollbar || Controls[cC] is DevExpress.XtraEditors.SimpleButton || Controls[cC] is ProgressBar)
                {
                    cC++;
                    continue;
                }
                if (Controls[cC] != null)
                {
                    //Controls[cC].Dispose();
                    Controls.RemoveAt(cC);
                }
            }
            int curr_adding_item = 0;
            for (int i = 0; i < ver_items; i++)
            {
                for (int j = 0; j < hor_items; j++)
                {
                    int cur_item = curr_adding_item + bar.Value * (hor_items * ver_items);
                    if (cur_item >= youtube_videos.Count)
                    {
                        return;
                    }
                    //Console.WriteLine(cur_item + " " + youtube_videos[cur_item].title);
                    PictureBox img = new PictureBox();
                    Label txt = new Label();

                    img.Cursor = Cursors.Hand;
                    img.SizeMode = PictureBoxSizeMode.StretchImage;
                    img.LoadAsync("http://" + youtube_videos[cur_item].image);
                    img.Left = left_margin + j * (left_margin + item_width);
                    img.Top = top_margin + i * (top_margin + item_heigh);
                    img.Width = image_width;
                    img.Height = image_heigh;
                    img.Name = "img_" + curr_adding_item;
                    img.MouseClick += new MouseEventHandler(img_MouseClick);
                    main_images.Add(img);
                    Controls.Add(img);

                    txt.Text = CrawlerLib.Net.Utility.HtmlDecode(youtube_videos[cur_item].title);
                    //Console.WriteLine(txt.Text);
                    txt.Top = img.Top + img.Height + 4;
                    txt.Left = img.Left;
                    txt.BackColor = System.Drawing.Color.Transparent;
                    txt.ForeColor = System.Drawing.Color.DarkGray;
                    txt.Width = img.Width;
                    Controls.Add(txt);

                    curr_adding_item++;
                }
            }
        }
开发者ID:nghoang,项目名称:tvkpme,代码行数:92,代码来源:YoutubeVideoList.cs

示例7: button2_Click

 private void button2_Click(object sender, EventArgs e)
 {
     if (i < 0) return;
     Form f = new Form();
     PictureBox pb = new PictureBox() { Dock = System.Windows.Forms.DockStyle.Fill, SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom };
     f.Controls.Add(pb);
     pb.LoadAsync(list[i].imageLinkLrg);
     f.ShowDialog();
 }
开发者ID:ZAYEC77,项目名称:HCI6,代码行数:9,代码来源:Form1.cs

示例8: Form1

        public Form1()
        {
            //Creating interface
            InitializeComponent();
            medianFilter = new MedianFilterClass();

            this.Icon = new Icon("favicon.ico");
            this.BackColor = Color.FromArgb(32, 30, 30);
            this.FormBorderStyle = FormBorderStyle.None;
            this.TopMost = true;
            this.Bounds = Screen.PrimaryScreen.Bounds;
            b = new Bitmap("Pet-cat-toilet-2.jpg");
            pb = new PictureBox();
            pb.WaitOnLoad = false;
            pb.LoadAsync("Pet-cat-toilet-2.jpg");
            TopMenu topMenu = new TopMenu(this, pb);
            pb.LoadCompleted += Pb_LoadCompleted;

            pb.BackgroundImage = new Bitmap("backgroundPattern.png");
            pb.Size = new Size(800, 600);
            pb.SizeMode = PictureBoxSizeMode.Zoom;
            pb.Location = new Point(60, 80);
            pb.Image = b;
            
            PictureBox imageBorder = new PictureBox();
            imageBorder.Location = new Point(51, 72);
            imageBorder.Size = new Size(816, 618);
            imageBorder.Image = new Bitmap("imageBorder.png");
            
            this.Controls.Add(imageBorder); 
            this.Controls.Add(pb);

            fm = new FilterManager(b, this);
            imageBorder.SendToBack();

            //Creating color scrolls block
            LabelNameForBlock colorName = new LabelNameForBlock("Work with color");
            colorName.Location = new Point(980, 80);
            this.Controls.Add(colorName);
            greenScroll = new FilterController(980, 110, Color.FromArgb(103, 184, 109), "G", 128, this);
                greenScroll.scroll.MouseUp += Sc_MouseUp; 
            redScroll = new FilterController(980, 140, Color.FromArgb(142, 50, 50), "R", 128, this);
                redScroll.scroll.MouseUp += Sc_MouseUp1;
            blueScroll = new FilterController(980, 170, Color.FromArgb(13, 120, 200), "B", 128, this);
                blueScroll.scroll.MouseUp += Scroll_MouseUp;

            //Creating brightness block
            LabelNameForBlock brightness = new LabelNameForBlock("Brightness");
            brightness.Location = new Point(980, 220);
            this.Controls.Add(brightness);
            brightnessScroll = new FilterController(980, 240, Color.FromArgb(144, 16, 45), "Bright", 128, this);
            brightnessScroll.scroll.MouseUp += Scroll_MouseUp1;

            //Creating PixelizationBlock
            LabelNameForBlock pixelization = new LabelNameForBlock("Pixelization");
            pixelization.Location = new Point(980, 280);
            this.Controls.Add(pixelization);
            pixelScroll = new FilterController(980, 300, Color.FromArgb(225, 166, 41), "P", 0, this);
            pixelScroll.scroll.MouseUp += Scroll_MouseUp2;

            //Creating OpacityBlock
            LabelNameForBlock opacity = new LabelNameForBlock("Opacity");
            opacity.Location = new Point(980, 340);
            this.Controls.Add(opacity);
            opacityScroll = new FilterController(980, 360, Color.FromArgb(75, 50, 70), "O", 255, this);
            opacityScroll.scroll.MouseUp += Scroll_MouseUp3;

            //Creating BlackAndWhiteBlock
            LabelNameForBlock blackWhite = new LabelNameForBlock("Black-White");
            blackWhite.Location = new Point(980, 400);
            this.Controls.Add(blackWhite);
            blackWhiteScroll = new FilterController(980, 420, Color.FromArgb(70, 190, 70), "w", 0, this);
            blackWhiteScroll.scroll.MouseUp += Scroll_MouseUp4;

            //Creating SegmentationBlock
            LabelNameForBlock segmentation = new LabelNameForBlock("Segmentation2D");
            segmentation.Location = new Point(980, 460);
            this.Controls.Add(segmentation);
            segmentation2DScroll = new FilterController(980, 480, Color.FromArgb(41, 144, 225), "S", 0, this);
            segmentation2DScroll.scroll.MouseUp += Scroll_MouseUp5;

            //To inverse button
            inverseButton = new SuperButtonForTools(Color.FromArgb(160, 75, 255), Color.White, "Inverse");
            inverseButton.Location = new Point(865, 72);
            inverseButton.MouseClick += inverseButton_MouseClick;
            this.Controls.Add(inverseButton);

            //BlackAndWhite button
            //blackWhiteButton = new SuperButton(Color.FromArgb(255, 75, 75), Color.White, "B/W");
            //blackWhiteButton.Location = new Point(865, 102);
            //blackWhiteButton.MouseClick += Sb_MouseClick;
            //this.Controls.Add(blackWhiteButton);
            
            //Segmentation button 
            segmentationButton = new SuperButton(Color.FromArgb(255, 75, 75), Color.White, "Segmentation");
            segmentationButton.Location = new Point(865, 102);
            segmentationButton.MouseClick += SegmentationButton_MouseClick;
            this.Controls.Add(segmentationButton);


//.........这里部分代码省略.........
开发者ID:DanilParshukov,项目名称:csharp_Projects,代码行数:101,代码来源:Form1.cs


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