public static void SetCursor(Control control, Cursor cursor) { if (control.InvokeRequired) { SetCursorCallback callback = new SetCursorCallback(SetCursor); control.BeginInvoke(callback, new object[] { control, cursor }); } else { control.Cursor = cursor; } }
public void setCursorState(bool cursorState) { // 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.progressBarProgressInformation.InvokeRequired) { SetCursorCallback d = new SetCursorCallback(setCursorState); this.Invoke(d, new object[] { cursorState }); } else { this.UseWaitCursor = cursorState; } }
private void onCursorSet() { if (_requestedCursor != null) { if (Pane.Control.InvokeRequired) { var d = new SetCursorCallback(onCursorSet); Pane.Control.Invoke(d); } else { Pane.Control.Cursor = _requestedCursor; } } }
private void ChangeCursor(Cursor cursor) { if (this.InvokeRequired) { SetCursorCallback d = new SetCursorCallback(ChangeCursor); if (this.IsHandleCreated && !this.IsDisposed) { try { this.Invoke(d, new object[] { cursor }); } catch { } } } else { this.Cursor = cursor; } }
/// <summary> /// Calls the parent (via interface, if implemented) to change the cursor used /// </summary> /// <param name="cursor">Cursor to use</param> public void SetCursor(System.Windows.Forms.Cursor cursor) { SetCursorCallback d = new SetCursorCallback(SetCursorUnsafe); this.Invoke(d, new object[] { cursor }); }