问题描述
您好,
我试图创建一个包含大约14个不同线程的应用程序,这些线程必须访问GUI并更新一些标签。现在,如果我这样做,经过一点点时间之后它有点挂起,我认为因为gui已经被两个或多个线程同时加入了。所以我试着用这段代码来解决这个问题:
Hi there,
Iam trying to make an app that has about 14 different threads which have to access the GUI and update some of the labels. Now if i do that, after a little whil it kinda hangs, I think its becaus the gui has been accesed by two or more threads at the same time. So i tried to solve this writing this code:
推荐答案
thx m8 = D.我尝试了另一种方法,将所有数据放在一个数组中,让一个线程用数组中的数据更新lbls。那不起作用=,(。所以我想尝试使用背景工作者,我读的应该更容易使用(只要它适用于我= p)
greetz ,bobido!
thx m8 =D. I tried another way, by putting all the data in an array and have one thread update the lbls with the data in the array. That didnt work =,(. So iam goin to try and use the backgroundworker, which I read should be easier to work with (as long as it works for me =p)
greetz, bobido!
这篇关于C#中的GUI线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!