[單項選擇題] 在窗體上畫一個名稱為Commana1的命令按鈕,然后編寫如下程序:Dim SW As Boolean Function func(X As
[單項選擇題] 在窗體上畫一個名稱為Commana1的命令按鈕,然后編寫如下程序:
Dim SW As Boolean
Function func(X As Integer)As Integer
If X<20 Then
Y=X
Else
Y=20+X
End If
func = Y
End Function
Private Sub Form MouseDown(Button As Integer,_
Shift As Integer,X As Single, Y As Single)
SW = False
End Sub
Private Sub Form_MouseUp( Button As Integer,_
Shift As Integer ,X As Single, Y As Single)
SW = True
End Sub
Private Sub Commandl_Click( )
Dim intNum As Integer
intNum = InputBox(" ")
If SW Then
Print func(intNum)
End If
End Sub
程序運行后,單擊命令按鈕,將顯示一個輸入對話框,如果在對話框中輸入25,則程序的執(zhí)行結(jié)果為
A.輸出0
B.輸出25
C.輸出45
D.無任何輸出
正確答案:C
參考解析:本題考查的是鼠標(biāo)事件,當(dāng)壓下鼠標(biāo)左鍵(發(fā)生MouseDown時)SW的值為False,當(dāng)松開鼠標(biāo)左鍵(觸發(fā)MouseUp時)SW的值為True。
詞條內(nèi)容僅供參考,如果您需要解決具體問題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢相關(guān)領(lǐng)域?qū)I(yè)人士。