下面程序是由鼠标事件在窗体上画图,如果按下鼠标可以画图,双击窗体则可以清除所画图形。补充完整下面的程序。首先在窗体层定义如下变量:Dim PaintStart As Boolean编写如下事件过程:Private Sub Form_Load()DrawWidth=2ForeColor=vbGreenEnd SubPrivate Sub Form_MouseDown(Button As Integer,Shift As Integer,X AS Single,Y AS Single)PaintStart=TrueEnd SubPrivate Sub Form_MouseMove(Button As Integer,Shift As Integer,X As Single,Y As Single)If PaintStart ThenPSet(X,Y)End IfEnd SubPrivate Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)End SubPrivate Sub Form_DblClick()ClsEnd Sub
下面程序是由鼠标事件在窗体上画图,如果按下鼠标可以画图,双击窗体则可以清除所画图形。补充完整下面的程序。首先在窗体层定义如下变量:
Dim PaintStart As Boolean
编写如下事件过程:
Private Sub Form_Load()
DrawWidth=2
ForeColor=vbGreen
End Sub
Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X AS Single,Y AS Single)
PaintStart=True
End Sub
Private Sub Form_MouseMove(Button As Integer,Shift As Integer,X As Single,Y As Single)
If PaintStart Then
PSet(X,Y)
End If
End Sub
Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)
End Sub
Private Sub Form_DblClick()
Cls
End Sub
相关考题:
下面对程序段运行结果叙述正确的是( )PrivateSubForm_Click()Caption="鼠标单击鼠标单击Picture=LoadPicture(App.Path+\window.jpg)Print欢迎使用VBEndSubPrivateSubForm_DblClick()Caption=鼠标双击Picture=LoadPicture()Print结束使用VBEndSubA.单击窗体时窗体的标题为鼠标单击,窗体上显示结束使用VBB.双击窗体时窗体的标题为鼠标双击,窗体上显示结束使用VBC.双击窗体时窗体的图片还在D.单击窗体时窗体的图片删除
以下叙述中错误的是 ______。A.双击鼠标可以触发DblClick事件B.窗体或控件的事件的名称可以由编程人员确定C.移动鼠标时,会触发MouseMove事件D.控件的名称可以由编程人员设定
当一个对象(如窗体或图片框)被移动或改变大小之后,或当一个覆盖该对象的窗体被移开之后,如果要保持该对象上所画图形的完整性,可以选择触发( )事件来完成图形的重画工作。A.PaintB.LoadC.ClickD.Active
当一个对象(如窗体或图片框)被移动或改变大小之后,或当一个覆盖该窗体被移开之后,如果要保持该所画图形的完整性,可以选择触发()事件来完成图形的重画工作. A、PaintB、LoadC、ClickD、Active
2、窗体的Load事件,在 时候触发。A.当应用程序启动后B.当鼠标单击窗体时C.当鼠标双击窗体时D.当窗体变成活动窗体时E.当改变窗体的大小时