是否有一个PictureBox控件的图像变化的事件? [英] Is there an event for an image change for a PictureBox Control?

查看:1747
本文介绍了是否有一个PictureBox控件的图像变化的事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何知道什么时候改变图片框?结果
的图像是否有图像的变化?


解决方案<事件/ DIV>

首先确保图像被异步加载。要做到这一点设置图片框的 WaitOnLoad财产为false(其,是默认值)

  pictureBox1.WaitOnLoad = FALSE; 



然后加载异步图像:

  pictureBox1.LoadAsync(neutrinos.gif); 



创建了图片框的LoadCompleted事件的事件处理。当异步图像加载操作完成,取消或出现异常时触发此事件。

  pictureBox1.LoadCompleted + = PictureBox1_LoadCompleted; 

私人无效PictureBox1_LoadCompleted(对象发件人,AsyncCompletedEventArgs E)
{
// ...
}

您可以找到有关MSDN此事件的详细信息:



http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox。 loadcompleted.aspx


How do I know when the image of the picturebox change?
Is there an event for an image change?

解决方案

First make sure that the images are loaded asynchronously. To do this set the PictureBox's WaitOnLoad property to false (which is the default value).

pictureBox1.WaitOnLoad = false;

Then load the image asynchronously:

pictureBox1.LoadAsync("neutrinos.gif");

Create an event handler for the PictureBox's LoadCompleted event. This event is triggered when the asynchronous image-load operation is completed, canceled, or caused an exception.

pictureBox1.LoadCompleted += PictureBox1_LoadCompleted;

private void PictureBox1_LoadCompleted(Object sender, AsyncCompletedEventArgs e) 
{       
    //...       
}

You can find more information about this event on MSDN:

http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.loadcompleted.aspx

这篇关于是否有一个PictureBox控件的图像变化的事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆