- 相關(guān)推薦
2015二級計算機考試《VB》復(fù)習(xí)重點:KeyPress和鼠標(biāo)事件
一、KeyPress事件
在窗體上畫一個控件(指前面所講的可以發(fā)生KeyPress事件的控件),并雙擊該控件,進入程序代碼窗口后,從“過程”框中選取KeyPress,即可定義KeyPress事件過程。一般格式為:
Private Sub Text1 _ KeyPress(KeyAscii As Integer)
End Sub
二、KeyDown和KeyUp事件
KeyDown和KeyUp事件的參數(shù)也有兩種形式,其中
Index As Integer
只用于控件數(shù)組,而
KeyCode As Integer,Shift As Integer
用于單個控件。
三、鼠標(biāo)事件
為了實現(xiàn)鼠標(biāo)操作,Visual Basic提供了3個過程模板:
(一)壓下鼠標(biāo)鍵事件過程
Sub Form_MouseDown(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
(二)松開鼠標(biāo)鍵事件過程
Sub Form_MouseUp(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
(三)移動鼠標(biāo)光標(biāo)事件過程
Sub Form_MouseMove(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
【二級計算機考試《VB》復(fù)習(xí)重點:KeyPress和鼠標(biāo)事件】相關(guān)文章:
2015二級計算機考試《VB》復(fù)習(xí)重點:Sub過程10-13
2016計算機二級《VB》考試的重點內(nèi)容10-15
2015二級計算機考試《VB》復(fù)習(xí)重點:建立多窗體09-23
計算機二級VB考試重點知識07-17
2017計算機二級考試《VB》第二章復(fù)習(xí)重點08-11
2017計算機二級考試《VB》第五章復(fù)習(xí)重點05-29
2017計算機二級考試《VB》第三章復(fù)習(xí)重點08-05
2017計算機二級考試《VB》第四章復(fù)習(xí)重點10-18