ListView控件的事件
AfterLabelEdit事件:在编辑当前被选中的ListItem对象的标签之后该事件发生。
语法:Private Sub Object_AfterLabelEdit(Cancel As Integer, Cewstring As String) AfterLabelEdit事件参数部分 描述 Object 对象表达式,其值是一个控件。 Cancel 整数,它确定标签编辑操作是否被取消。任何非零整数取消该操作。也可以接受布尔值。 NewString 用户输入的字符串或Null,该值为Null时表示用户取消了该操作。 BeforeLabelEdit事件:当试图编辑当前被选中的ListItem对象的标签时该事件发生。
语法:Private Sub Object_BeforeLabelEdit(Cancel As Integer)
Click事件:在控件上按下然后释放一个鼠标按钮时发生。
语法:Private Sub Object_Click [(Index As Integer)]
ColumnClick事件:单击控件中的ColumnHeader对象时,该事件发生。仅当控件的View属性为报表视图时可用。
语法:Private Sub Object_ColumnClick(ByVal ColumnHeader As ColumnHeader)
DblClick事件:当在控件上双击时,该事件发生。
语法:Private Sub Object_DblClick [(Index As Integer)]
DragDrop事件:在一个完整的拖放动作(即将一个控件拖动到一个对象上,并释放鼠标按钮)完成,或使用Drag方法,并将其Action参数被设置为2(Drop)时,该事件发生。
语法:Private Sub Object_DragDrop([Index As Integer, ] Source As Control, x As Single, y As Single)
DragOver事件:它在拖放操作正在进行时发生。可使用此事件对鼠标指针在一个有效目标上的进入、离开或停顿等进行监控。鼠标指针的位置决定接收此事件的目标对象。当State=0表示控件正被向一个目标范围内拖动;State=1表示控件正被向一个目标范围外拖动;State=2表示控件在目标范围内从一个位置移到了另一位置。
语法:Private Sub Object_DragOver([Index As Integer, ] Source As Control, x As Single, y As Single, State As Integer)
GotFocus事件:当对象获得焦点时产生该事件;获得焦点可以通过诸如Tab键切换,或单击对象之类的用户动作,或在代码中用SetFocus方法改变焦点来实现。
语法:Private Sub Object_GotFocus [(Index As Integer)] ItemClick事件:单击控件中ListItem对象时事件发生。
语法:Private Sub Object_ItemClick(ByVal Item As ListItem)
KeyDown事件:对象具有焦点并按下一个键时发生。
语法:Private Sub Object_KeyDown([Index As Integer, ] Keycode As Integer, Shift As Integer)
KeyPress事件:对象具有焦点并按下或松开一个键时发生。
语法:Private Sub Object_KeyPress([Index As Integer, ] KeyAscii As Integer)
KeyUp事件:对象具有焦点并松开一个键时发生。
语法:Private Sub Object_KeyUp([Index As Integer, ] Keycode As Integer, Shift As Integer)
LostFocus事件:此事件是在一个对象失去焦点时发生,焦点的丢失可以是由于制表键移动或单击另一个对象操作的结果,或是代码中使用SetFocus方法改变焦点的结果。
语法:Private Sub Object_LostFocus [(Index As Integer)]
MouseDown事件:当按下鼠标按钮时发生。
语法:Private Sub Object_MouseDown([Index As Integer, ] Button As Integer, Shift As Integer, x As Single, y As Single)
MouseMove事件:当移动鼠标时发生。
语法:Private Sub Object_MouseMove([Index As Integer, ] Button As Integer, Shift As Integer, x As Single, y As Single)
MouseUp事件:当释放鼠标按钮时发生。
Private Sub Object _MouseUp([Index As Integer, ] Button As Integer, Shift As Integer, x As Single, y As Single) OLECompleteDrag事件:当源部件被放到目标部件时发生,并通知源部件拖放操作被执行或取消。
语法:Private Sub Object_OLECompleteDrag [(Effect As Long)]
OLEDragDrop事件:当源部件决定放操作能发生,且源部件被放到目标部件时,此事件发生。
语法:Private Sub Object_OLEDragDrop(Data As DataObject, effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
OLEDragOver事件:当一个部件在另一个部件上拖动时发生。
语法:Private Sub Object_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
OLEGiveFeedback事件:在每个OLEDragOver事件后发生
语法:Private Sub Object_OLEGiveFeedback(Effect As Long,DefaultCursors As Boolean)
OLESetData事件:当目标部件在源的DataObject对象上执行GetData方法,但是还没有加载规定格式的数据之前,在源部件上发生。
语法:Private Sub Object_OLESetData(Data As DataObject, Dataformat As Integer)
OLEStartDrag事件:当部件的OLEDrag方法被执行时,或者在OLEDragMode属性被设为Automatic,部件初始化OLE拖放操作时发生。
语法:Private Sub Object_OLEStartDrag(Data As DataObject, Allowedeffects As Long) Validate事件:在焦点转换到一个控件之前发生,此时该控件的CausesValidation属性值设置为True。
语法:Private Sub Object_Validate(KeepFocus As Boolean)