设窗体上有一个标签Label1,并编写了下面的过程 Private Sub Form_MouseMove(Button As Integer,Shift As Integer,_ X As Single,Y As Single) If B

admin2016-06-30  21

问题 设窗体上有一个标签Label1,并编写了下面的过程
Private Sub Form_MouseMove(Button As Integer,Shift As Integer,_
    X As Single,Y As Single)
    If Button=1 Then
    Labell=”X=”&X&”Y=”& Y
    End If
    End Sub
    程序运行后的效果是(    )。

选项 A、当按下鼠标左键并移动鼠标时,鼠标的位置坐标会同步显示在标签中
B、当按下鼠标右键并移动鼠标时,鼠标的位置坐标会同步显示在标签中
C、当移动鼠标时,鼠标的位置坐标会同步显示在标签中
D、当按下鼠标左键时,鼠标的位置坐标会同步显示在标签中

答案A

解析 MouseMove意鼠标移动。本题中指移动鼠标光标事件过程
    Sub Form_MouseMove(Button As Integer,Shift As Integer,X As Single,Y As Single)
    End Sub
    上述事件过程适用于窗体和大多数控件,包括复选框、命令按钮、单选按钮、框架、文本框、目录框、文件框、图像框、图片框?、标签、列表框等。
    移动鼠标事件过程参数,其含义如下:
    ①Button:被按下的鼠标键,可以取3个值,如表2.2所示:

    ②Shift:表示Shift、Ctrl、Alt的状态。
    ③x、y鼠标光标的当前位置。
    本题中使用if语句判断Button是否等于1,即判断是否按下了鼠标左键,若,,则将鼠标光标的x,Y坐标值显示在标签Labell上。故选项A正确。
转载请注明原文地址:https://jikaoti.com/ti/OuJ0FFFM
0

最新回复(0)