public void SetHeight(int data) { if (this.InvokeRequired) { SetHeightCallback d = new SetHeightCallback(SetHeight); this.Invoke(d, new object[] { data }); } else { this.Height = data; } }
private void SetFormHeightValue(int value) { // 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 (this.InvokeRequired) { SetHeightCallback d = new SetHeightCallback(SetFormHeightValue); try { this.Invoke(d, new object[] { value }); } catch (Exception) { } } else { this.Height = value; } }