/// <summary>
/// Safely set the <see cref="ProgressBar.Maximum"/> of the ProgressBar across threads.
/// </summary>
/// <param name="control"></param>
/// <param name="value"></param>
public static void Maximum( this ProgressBar control, int value ) {
if ( null == control ) {
return;
}
if ( control.InvokeRequired ) {
control.BeginInvoke( new Action( () => {
if ( control.IsDisposed ) {
return;
}
control.Maximum = value;
control.Refresh();
} ) );
}
else {
control.Maximum = value;
control.Refresh();
}
}
No comments:
Post a Comment