当前位置:网站首页>WinForm UI interface design routine - multi thread access UI control
WinForm UI interface design routine - multi thread access UI control
2022-07-21 12:36:00 【Zheng who must run】
Here we discuss two kinds of multi-threaded access UI Control method , Update after thread completion Lable Control
Here's the picture , The first way is way 1 Button press , Thread running , And update the label
The second method is to press 2 Button , Thread running , Update when done label
newly build winform Project procedures , The layout is as above , You can use no color matching , Simple
quote
using System.Threading;
The first method : Use delegate and invoke To call the control from other threads
When a control of InvokeRequired When the attribute value is true , It indicates that a thread other than creating it wants to access it , So we judge this attribute to update label Value
private void button1_Click(object sender, EventArgs e)
{
Thread thread1 = new Thread(new ParameterizedThreadStart(UpdateLabel));
thread1.Start(" to update label");
}
private void UpdateLabel(object str)
{
if (label1.InvokeRequired)
边栏推荐
- The getsubmittedfilename() method is unavailable
- RXJS概念的个人理解:响应式编程思想
- Basic usage of async function and await expression in ES6
- APP UI自动化测试常见面试题,或许有用呢~
- Openvino安装时的一些记录
- Shuize - information collection automation tool installation
- [problem solving] how to transfer files to win server
- Is it safe to open an account on Oriental Fortune? I dare not open it before
- Combine pyqt5 to develop one click conversion software for office documents, and there is no need to open members to transfer files in the future
- pyqt5使用QFile跟QDataStream进行二进制文件的读写
猜你喜欢
技术分享 | 实战详解接口测试请求方式Get、post
查询mysql的最大连接数和当前连接数
[problem solving] how to transfer files to win server
类和对象【上】
【云原生 • DevOps】一文掌握持续集成工具 Jenkins
Winform UI界面设计例程——多线程访问UI控件
Cbcgptreectrlex control used by BCG
ACL and NAT
Orepa: Ali proposed a heavy parameter strategy with fast training. The memory is halved and the speed is doubled | CVPR 2022
RXJS概念的个人理解:响应式编程思想
随机推荐
CAD文字样式
The meaning of null in C language
What are the interview questions for test engineers you have encountered?
Share a little personal software testing experience and feelings after 13 years of work
Technology sharing | detailed explanation of actual combat interface test request methods get, post
函数默认参数避坑指南
The getsubmittedfilename() method is unavailable
Problems of puts () for C language beginners
机器学习作业2
flutter Animation动画
云渲染,设计行业的“新贵”
Postgraduate entrance examination - Database
visual studio输入!没有提示
数据库系统概论--分析题
How Jenkins sends email, advanced test hands-on to teach you
Basic usage of async function and await expression in ES6
It's just a TCC distributed transaction. Is it so difficult?
EL & JSTL: El: Department information query, jstl: Department query
数据采集与预处理课设——人在回路的气温数据动态处理与可视化
请问民生期货怎么样?安全吗?