DataGridView.OnCursorChanged(EventArgs) 方法

定义

如果光标在用户代码中更改,将会引发 CursorChanged 事件并更新 UserSetCursor 属性。Raises the CursorChanged event and updates the UserSetCursor property if the cursor was changed in user code.

protected:
 override void OnCursorChanged(EventArgs ^ e);
protected override void OnCursorChanged (EventArgs e);
override this.OnCursorChanged : EventArgs -> unit
Protected Overrides Sub OnCursorChanged (e As EventArgs)

参数

e
EventArgs

包含事件数据的 EventArgsAn EventArgs that contains the event data.

注解

@No__t-0 控件根据鼠标指针的位置更改 @no__t 属性值。The DataGridView control changes the Cursor property value depending on the location of the mouse pointer. @No__t-0 属性存储 @no__t 属性的正常值,并忽略控件的更改。The UserSetCursor property stores the normal value of the Cursor property and ignores the control's changes. 此方法是在 CursorChanged 事件发生时调用的,如果需要,还会更新 @no__t 属性(如有必要),并调用任何事件处理程序。This method is called when the CursorChanged event occurs, and it updates the UserSetCursor property, if necessary, in addition to invoking any event handlers.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅处理和引发事件For more information, see Handling and Raising Events.

OnCursorChanged 方法还允许派生类对事件进行处理而不必附加委托。The OnCursorChanged method also allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

在派生类中重写 OnCursorChanged(EventArgs) 时,请确保调用基类 "OnCursorChanged(EventArgs) 方法,以便注册的委托接收事件。When overriding OnCursorChanged(EventArgs) in a derived class, be sure to call the base class' OnCursorChanged(EventArgs) method so that registered delegates receive the event.

适用于

另请参阅