单选题
VB
题号 #2538787
有一个名称为Form1的窗体,上面没有控件,设有以下程序(其中方法Pset(X,Y)的功能是在坐标X,Y 处画一个点):
Di mc mdmave As Boolean
Private Sub Form_MouseDown (Button As Integer ,Shift As Integer ,X As Si ngle ,Y As Si ngle) c mdmave =True
End Sub
Private Sub Form_Mouse Move(Button As Integer ,ShiftAs Integer ,X As Si ngle ,Y As Si ngle) If c mdmave Then Form1.Pset(X,Y)
End If
End Sub
Private Sub Form_Mouse Up(Button As Integer ,ShiftAs Integer ,X As Si ngle ,Y As Si ngle) c mdmave =False
End Sub
此程序的功能是( )。
参考答案
D
答案解析
Pset(X,Y)函数是在X、Y 处画出一个点,Form_MouseDown 函数中只有一个c mdmave =True ,即当鼠标按下就将c mdmave 赋值为True ,Form_Mouse-Move 函数是当c mdmave 为True 时就执行Pset(x,y)函数,即当移动鼠标且c mdmave =True 时就不断的画点,即形成一条线;而Form_Mouse Up 函数是将c mdmave 赋为false ,即松开鼠标时不再画点。故整个程序的功能是按下鼠标键并拖动鼠标,沿鼠标拖动的轨迹画一条线,放开鼠标键就结束画线。
你可能感兴趣的试题
A.把语句n =1改为n =0
B.把循环条件a\10>=0改为a\10>0
C.把语句a=a\10改为a=a Mod 10
D.把语句fun =n 改为fun =a
A.Private Sub Check1_Click(Index As Integer)
Text1.Text =""
For k =0To 3
If Check1(k).value =1Then
Text1.Text =Text1.Text &Check1(k).Caption &""双引号中是空格 End If Next k
End Sub
Text1.Text =""
For k =0To 3
If Check1(k).value =1Then
Text1.Text =Text1.Text &Check1(k).Caption &""双引号中是空格 End If Next k
End Sub
B.Private Sub Check1_Click(Index As Integer)
For k =0To 3
If Check1(k).Value =1Then
Text1.Text =Text1.Text &Check1(k).Caption &""双引号中是空格
End If
Next k
End Sub
For k =0To 3
If Check1(k).Value =1Then
Text1.Text =Text1.Text &Check1(k).Caption &""双引号中是空格
End If
Next k
End Sub
C.Private Sub Check1_Click(Index As Integer)
Text1.Text ="" For k =0To 3 If Check1(k).Value =1Then
Text1.Text =Text1.Text &Check1(Index).Caption &""双引号中是空格
End If
Next k
End Sub
Text1.Text ="" For k =0To 3 If Check1(k).Value =1Then
Text1.Text =Text1.Text &Check1(Index).Caption &""双引号中是空格
End If
Next k
End Sub
D.Private Sub Check1_Click(Index As Integer)
Text1.Text ="" For k =0To 3
If Check1(k).Value =1Then
Text1.Text =Text1.Text &Check1(k).Caption &""双引号中是空格
Exit For
End If
Next k
End Sub
Text1.Text ="" For k =0To 3
If Check1(k).Value =1Then
Text1.Text =Text1.Text &Check1(k).Caption &""双引号中是空格
Exit For
End If
Next k
End Sub


