全部题库 / VB / 试题详情
单选题 VB
2014-02-18

在窗体上先后画2个图片框,名称分别为Picture1和banana,banana 中添加了香蕉图片,如图1所示,且将banana.Drag Mode 属性设置为1。要求程序运行时,可以用鼠标把banana 拖拽到Picture1中,如图2所示。能实现此功能的事件过程是(  )。

A.Private Sub Form_DragDrop(Source As Control ,XAs Si ngle ,Y As Si ngle)
banana . Move Picture1 . Left +X,Picture1 . Top +Y
End Sub
B.Private Sub banana_DragDrop(Source As Control ,XAs Si ngle ,Y As Si ngle)
Source . Move Picture1 . Left +X,Picture 1 . Top +Y
End Sub
C.Private Sub Picture1_DragDrop(Source As Control ,X As Si ngle ,Y As Si ngle)
Source . Move Picture1 . Left +X,Picture1 . Top +Y
End Sub
D.Private Sub Picture1_DragDrop(Source As Control ,X As Si ngle ,Y As Si ngle)
banana . Move banana . Left +X,banana . Top +Y
End Sub

参考答案

C

答案解析

Drag Mode 属性返回或设置一个值,确定在拖放操作过程中所使用的是手动还是自动拖动方式,当属性设置为1(自动方式)时,控件不能正常响应鼠标事件,在拖放操作过程中,当鼠标器指针在一个目标对象或窗体上时,单击鼠标会对目标对象产生DragDrop 事件。而source .move 是控件移动,picture1.left +x 图片当前位置加鼠标X 位置,picture1.top +y 图片当前高度位置加鼠标Y的位置即把图片移动到picture1.left +x,picture1.top +y位置。

你可能感兴趣的试题

A.Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii =13Then
回车符的ASCII 码是13
a=Val(Text1)
If a >=0Or a <=100Then
Text2 . SetFocus
Else
Text1 . SetFocus :MsgBox ("分数错")
End If
End If
End Sub
B.Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii =13Then 回车符的ASCII 码是13
a=Val(Text1)
If a >=0And a <=100Then
Text1 . SetFocus
Else
Text2 . SetFocus :MsgBox ("分数错")
End If
End If
End Sub
C.Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii =13Then 回车符的ASCII 码是13
a=Val(Text1)
If a <0And a >100Then
Text2 . SetFocus
Else
Text1 . SetFocus :MsgBox ("分数错")
End If
End If
End Sub
D.Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii =13Then 回车符的ASCII 码是13
a=Val(Text1)
If a >=0And a <=100Then
Text2.SetFocus
Else
Text1.SetFocus :MsgBox ("分数错")
End If
End If
End Sub