private bool IsShow = true;
delegate void SetVisibilityCallback(bool show);
private void SetVisibilityThreadSafe(bool show)
{
if (btnCancelUsage.InvokeRequired)
{
SetVisibilityCallback d = SetVisibilityThreadSafe;
btnCancelUsage.Invoke(d, show);
}
else
{
btnCancelUsage.Visible = IsShow;
}
}