二级计算机考试《VB》复习重点:KeyPress和鼠标事件

时间:2025-11-01 06:29:43 试题

2015二级计算机考试《VB》复习重点:KeyPress和鼠标事件

  一、KeyPress事件

2015二级计算机考试《VB》复习重点:KeyPress和鼠标事件

  在窗体上画一个控件(指前面所讲的可以发生KeyPress事件的控件),并双击该控件,进入程序代码窗口后,从“过程”框中选取KeyPress,即可定义KeyPress事件过程。一般格式为:

  Private Sub Text1 _ KeyPress(KeyAscii As Integer)

  End Sub

  二、KeyDown和KeyUp事件

  KeyDown和KeyUp事件的参数也有两种形式,其中

  Index As Integer

  只用于控件数组,而

  KeyCode As Integer,Shift As Integer

  用于单个控件。

  三、鼠标事件

  为了实现鼠标操作,Visual Basic提供了3个过程模板:

  (一)压下鼠标键事件过程

  Sub Form_MouseDown(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub

  (二)松开鼠标键事件过程

  Sub Form_MouseUp(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub

  (三)移动鼠标光标事件过程

  Sub Form_MouseMove(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub

【二级计算机考试《VB》复习重点:KeyPress和鼠标事件】相关文章:

2015二级计算机考试《VB》复习重点:鼠标光标的形状03-01

2015二级计算机考试《VB》复习重点:VB菜单02-10

计算机二级VB考试重点03-10

2015二级计算机考试《VB》复习重点:Function过程和参数传送02-11

计算机二级VB考试重点考点09-27

2015二级计算机考试《VB》复习重点:Sub过程11-16

计算机二级《VB》复习重点:Visual Basic的特点12-20

2017计算机二级考试《VB》第二章复习重点09-07

2017计算机二级考试《VB》第五章复习重点03-14