- 相關(guān)推薦
2015二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn):KeyPress和鼠標(biāo)事件
一、KeyPress事件
在窗體上畫一個(gè)控件(指前面所講的可以發(fā)生KeyPress事件的控件),并雙擊該控件,進(jìn)入程序代碼窗口后,從“過程”框中選取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
用于單個(gè)控件。
三、鼠標(biāo)事件
為了實(shí)現(xiàn)鼠標(biāo)操作,Visual Basic提供了3個(gè)過程模板:
(一)壓下鼠標(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
(三)移動(dòng)鼠標(biāo)光標(biāo)事件過程
Sub Form_MouseMove(Button As Integer,Shift As Integer,x As Single,y As Single)End Sub
【二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn):KeyPress和鼠標(biāo)事件】相關(guān)文章:
2015二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn):鼠標(biāo)光標(biāo)的形狀06-28
2015二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn):VB菜單07-22
計(jì)算機(jī)二級(jí)VB考試重點(diǎn)08-01
2015二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn):Function過程和參數(shù)傳送09-03
計(jì)算機(jī)二級(jí)VB考試重點(diǎn)考點(diǎn)10-24
2015二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn):Sub過程10-13
2015二級(jí)計(jì)算機(jī)考試《VB》復(fù)習(xí)重點(diǎn)知識(shí):文件09-10