Control.invoke and parental controls

Suppose I have a MainForm form and a control: somelabel. To access these controls from another thread, I have to use the Invoke method. eg:

somelabel.Invoke(...);

However, I can also access the shortcut through a form like this:

MainForm.Invoke(...) //Code for manipulating somelabel

Is there a difference between the two snippets in terms of performance or some other technical aspect?

+3
source share
2 answers

. Windows Invoke, . , ( ), , .

. , , , . - WindowsFormsSynchronizationContext, SynchronizationContext.Current. , ( Send/Post Invoke), , any.

+4

... , . , , , . , - , , .

, , , (, , , ). , , , , .

+2

Source: https://habr.com/ru/post/1730273/


All Articles