I\'ve been struggling with this for quite a while: I have a function designed to add control to a panel with cross-thread handling, the problem is that though the panel and
As an aside - to save yourself having to create countless delegate types:
if (panel.InvokeRequired)
{
panel.Invoke((MethodInvoker) delegate { AddControlToPanel(panel,ctrl); } );
return;
}
Additionally, this now does regular static checks on the inner call to AddControlToPanel
, so you can't get it wrong.