我怎么知道当图像在PictureBox中加载 [英] How do I know when an Image is loaded in Picturebox

查看:93
本文介绍了我怎么知道当图像在PictureBox中加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些巨大的图像(7000 * 5000)在我的计划,我在PictureBox中一一展示同时加载。这些图像需要花费一些时间在图片框加载。起初我加载的所有图像在图片阵列位图,那么我只是表示第一在PictureBox的Image picturebox.Image = imageArray [0] 。所以,我想告诉等待光标,直到第一个图像在PictureBox中显示。 ?有什么办法,当第一个图像的图片框显示要知道

I've some huge images (7000*5000) to load simultaneously in my program, which I'm displaying in picturebox one by one. These images take some time to load in the PictureBox. At first I'm loading all the images in an Image array as Bitmap, then I'm just showing the first image in picturebox picturebox.Image = imageArray[0]. So I want to show wait cursor until first image is shown in Picturebox. Is there any way to know when the first image is shown on Picturebox?

推荐答案

您可以使用图片框事件:的 LoadProgressChanged 来显示加载进度和 LoadCompleted 做的,当它完成的东西。

You can use the PictureBox events : LoadProgressChanged to show the loading progress and LoadCompleted to do something when it is finished.

private void pictureBox1_LoadProgressChanged(object sender, ProgressChangedEventArgs e)
{
    // animate a progressbar...
}

private void pictureBox1_LoadCompleted(object sender, AsyncCompletedEventArgs e)
{
    // done !
}

要完成这项工作,你必须保持在 .WaitOnLoad 值属性设为False,你必须使用 LoadAsync 方法之一。

To make this work, you have to keep the .WaitOnLoad value property to False, and you have to use one of the LoadAsync method.

这篇关于我怎么知道当图像在PictureBox中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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