A-A+
在窗体上画一个名称为Command1的命令按钮 然后编写如下程序: Dim SW As Bo
问题详情
在窗体上画一个名称为Command1的命令按钮,然后编写如下程序: Dim SW As Boolean Function func(X As Integer)As Integer IfX<20 Then Y=X Else Y=20+X End lf 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 SinSle,Y As Single) SW=True End Sub Prinvate Sub Command1_Click() Dim intNum As Integer intNum=InputBox(””) If SW Then Print func(intNum) End If End Sub 程序运行后,单击命令按钮,将显示一个输入对话框,如果在对话框中输入25,则程序的执行结果为
A.输出0
B.输出25
C.输出45
D.无任何输出请帮忙给出正确答案和分析,谢谢!
参考答案
正确答案:C
解析:当压下鼠标左键(发生MouseDown)时SW的值为False,当松开鼠标左键(触发MouseUP)时SW的值为True。