/// <summary>
/// Perform an <see cref="Action"/> on the control's thread.
/// </summary>
/// <param name="control"></param>
/// <param name="action"></param>
public static void OnThread( this Control control, Action action ) {
if ( null == control ) {
return;
}
if ( null == action ) {
return;
}
if ( control.InvokeRequired ) {
control.BeginInvoke( action );
control.Invalidate();
}
else {
action();
control.Invalidate();
}
}
No comments:
Post a Comment