UI线程安全 [英] UI Thread Safety

查看:115
本文介绍了UI线程安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在保证线程安全改变表格控件的属性时,最好的方法有什么建议?我一直在使用Me.Invoke在过去,我想知道,如果你有优点/缺点,意见,建议等。

Any suggestions on the best way to ensure thread safety when changing the properties on Form controls? I have been using Me.Invoke in the past, and I was wondering if you have pros/cons, comments, suggestions, etc.

推荐答案

调用是正确的方式做到这一点,如果你从另一个线程推东西的形式。

Invoke is the proper way to do it if you're pushing stuff at the form from another thread.

但是,你可能会考虑是否形式可能是更好的提取数据本身,或许可以从一个计时器,也许不经常比一个后台进程可能会推单个更新。

But you might consider whether the form might be better pulling data itself, perhaps from a timer, and perhaps less frequently than a background process might push individual updates.

这篇关于UI线程安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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