全部题库 / VB / 试题详情
单选题 VB
2013-08-15

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

A.Private 3ub Form—DragDrop(Source As Control,X As Single,Y As Single)
banana.Move Picture1.Left+X,Picture1.Top+Y
End Sub
B.Private Sub banana_DragDrop(Source As Control,X As Single,Y As Single)
Source.Move Picture1.Left+X,Picture 1.Top+Y
End Sub
C.Private Sub Picture1_DragDrop(Source As Control,X As Single,Y As Single)
Source.Move Picture1.Left+X,Picture1.Top+Y
End Sub
D.Private Sub Picture1_DragDrop(Source As Control,X As Single,Y As Single)
banana.Move banana.Left+X,banana.Top +Y
End Sub

参考答案

C

答案解析

C。【解析】DragMode属性返回或设置一个值,确定在拖放操作过程中所使用的是手动还是自动拖动方式,当属性设置为1(自动方式)时,控件不能正常响应鼠标事件,在拖放操作过程中,当鼠标器指针在
一个目标对象或窗体上时,单击鼠标会对目标对象产生DragDrop事件。而Source.Move是控件移动,Pic ture1.Left+X图片当前位置加鼠标X位置,Picture1.Top+Y图片当前高度位置加鼠标Y的位置即把图片移动到Picture1.Lefl+X,Picture1.Top+Y位置。

你可能感兴趣的试题

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