当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
2015年全国计算机二级VB考点解析:第十章
发布时间:2014/7/25 11:19:47 来源:www.ceoba.com 编辑:jennifer

一、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

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved