强制顺序执行 [英] Forcing sequential execution

查看:88
本文介绍了强制顺序执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个处理图像,我想在执行时间功能时显示



以下是我的代码

I have a processing image which i want to show while a time taking function is executed

Following is my code

pictureBox1.Visible=true;
send();//time taking function
pictureBox1.Visible=false;
MessageBox.show("success");



但我看不到图像和成功消息在执行结束之前发送()



请帮帮....


But i cant see the image and success message comes before the end of execution of send()

Please help....

推荐答案

为什么不将处理任务移动到 BackgroundWorker [ ^ ]线程?

您创建线程,显示图像,然后启动工作人员。

在工作完成事件中,您隐藏图像。 />
这样你的用户界面仍然保持响应,任务在后台处理。



链接包含一个例子。
Why not move the processing task into a BackgroundWorker[^] thread?
You create the thread, show the image, and start the worker.
In the worker completed event, you hide the image.
That way your UI remains responsive, and the task is handled in the background.

The link includes an example.


这篇关于强制顺序执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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