- 相關(guān)推薦
2015二級計算機考試《VB》復習重點(diǎn):KeyPress和鼠標事件
一、KeyPress事件

在窗體上畫(huà)一個(gè)控件(指前面所講的可以發(fā)生KeyPress事件的控件),并雙擊該控件,進(jìn)入程序代碼窗口后,從“過(guò)程”框中選取KeyPress,即可定義KeyPress事件過(guò)程。一般格式為:
Private Sub Text1 _ KeyPress(KeyAscii As Integer)
End Sub
二、KeyDown和KeyUp事件
KeyDown和KeyUp事件的參數也有兩種形式,其中
Index As Integer
只用于控件數組,而
KeyCode As Integer,Shift As Integer
用于單個(gè)控件。
三、鼠標事件
為了實(shí)現鼠標操作,Visual Basic提供了3個(gè)過(guò)程模板:
(一)壓下鼠標鍵事件過(guò)程
Sub Form_MouseDown(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
(二)松開(kāi)鼠標鍵事件過(guò)程
Sub Form_MouseUp(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
(三)移動(dòng)鼠標光標事件過(guò)程
Sub Form_MouseMove(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
【二級計算機考試《VB》復習重點(diǎn):KeyPress和鼠標事件】相關(guān)文章:
2015二級計算機考試《VB》復習重點(diǎn):鼠標光標的形狀06-28
2015二級計算機考試《VB》復習重點(diǎn):VB菜單07-22
計算機二級VB考試重點(diǎn)08-01
2015二級計算機考試《VB》復習重點(diǎn):Function過(guò)程和參數傳送09-03
計算機二級VB考試重點(diǎn)考點(diǎn)10-24
2015二級計算機考試《VB》復習重點(diǎn):Sub過(guò)程10-13
2015二級計算機考試《VB》復習重點(diǎn)知識:文件09-10