Multiple UI threads on the same window

2020-07-24 03:03发布

I don't want multiple windows, each with its own UI thread, nor events raised on a single UI thread, not background workers and notifications, none of that Invoke, BeginInvoke stuff either.

  • I'm interested in a platform that allows multiple threads to update the same window in a safe manner. Something like first thread creates three buttons, the second thread another five, and they both can access them,change their properties and delete them without any unwanted consequences.
  • I want safe multi-threaded access to the UI without Invoking, a platform where the UI objects can be accessed directly from any thread without raising errors like "The object can only be accessed from the thread that created it". To let me do the synchronizing if I have to, not prevent me from cross-tread accessing the UI in a direct manner.

8条回答
啃猪蹄的小仙女
3楼-- · 2020-07-24 03:59

Accept that any code updating the GUI has to be on the GUI thread. Learn to use BeginInvoke().

查看更多
登录 后发表回答