问题
What's the difference between check InvokeRequired and call Invoke method for a control
and for the parent form if I want to deal with the control from another thread?
if (theForm.InvokeRequired)
Invoke(...)
Or
if (myControl.InvokeRequired)
myControl.Invoke(...)
From MSDN:
The Invoke method searches up the control's parent chain until it finds a control or form that has a window handle if the current control's underlying window handle does not exist yet.
回答1:
These two have the same effect. You can assume the form and the control were created on the same thread.
来源:https://stackoverflow.com/questions/4154380/is-there-any-difference-between-using-invoke-for-the-parent-form-or-for-the-targ