private void SetVis(bool vis, Control label) { if (label.InvokeRequired) { SetVisCallback d = new SetVisCallback(SetVis); label.Invoke(d, new object[] { vis, label }); } else { label.Visible = vis; } }
private void SetLabel() { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (ThinkLabel.InvokeRequired) { SetVisCallback d = new SetVisCallback(SetLabel); ThinkLabel.Invoke(d, new object[] {}); } else { ThinkLabel.Visible = false; } }
private void SetControlVisible(bool win, Control c) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (winnerLabel.InvokeRequired) { SetVisCallback d = new SetVisCallback(SetControlVisible); winnerLabel.Invoke(d, new object[] { win, c }); } else { c.Visible = win; } }