vb中如何实现一个随鼠标移动的矩形?
我现在的代码:PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)La...
我现在的代码:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.Caption = X
Label4.Caption = Y
Line (X - 100, Y - 100)-(X - 100, Y + 100)
Line (X - 100, Y - 100)-(X + 100, Y - 100)
Line (X + 100, Y - 100)-(X + 100, Y + 100)
Line (X - 100, Y + 100)-(X + 100, Y + 100)
End Sub
上面的代码可以随鼠标移动出现矩形,但鼠标移动路径上的所有矩形都留在画面上,而我想让界面上只显示当前的矩形,不知道怎么实现,请高手指点,谢谢了! 展开
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.Caption = X
Label4.Caption = Y
Line (X - 100, Y - 100)-(X - 100, Y + 100)
Line (X - 100, Y - 100)-(X + 100, Y - 100)
Line (X + 100, Y - 100)-(X + 100, Y + 100)
Line (X - 100, Y + 100)-(X + 100, Y + 100)
End Sub
上面的代码可以随鼠标移动出现矩形,但鼠标移动路径上的所有矩形都留在画面上,而我想让界面上只显示当前的矩形,不知道怎么实现,请高手指点,谢谢了! 展开
展开全部
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
Label2.Caption = X
Label4.Caption = Y
Line (X - 100, Y - 100)-(X - 100, Y + 100)
Line (X - 100, Y - 100)-(X + 100, Y - 100)
Line (X + 100, Y - 100)-(X + 100, Y + 100)
Line (X - 100, Y + 100)-(X + 100, Y + 100)
End Sub
or
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
Label2.Caption = X
Label1.Caption = Y
Line (X - 100, Y - 100)-(X + 100, Y + 100), , B
End Sub
Cls
Label2.Caption = X
Label4.Caption = Y
Line (X - 100, Y - 100)-(X - 100, Y + 100)
Line (X - 100, Y - 100)-(X + 100, Y - 100)
Line (X + 100, Y - 100)-(X + 100, Y + 100)
Line (X - 100, Y + 100)-(X + 100, Y + 100)
End Sub
or
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Cls
Label2.Caption = X
Label1.Caption = Y
Line (X - 100, Y - 100)-(X + 100, Y + 100), , B
End Sub
展开全部
加一行cls
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.Caption = X
Label4.Caption = Y
Cls
Line (X - 100, Y - 100)-(X - 100, Y + 100)
Line (X - 100, Y - 100)-(X + 100, Y - 100)
Line (X + 100, Y - 100)-(X + 100, Y + 100)
Line (X - 100, Y + 100)-(X + 100, Y + 100)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label2.Caption = X
Label4.Caption = Y
Cls
Line (X - 100, Y - 100)-(X - 100, Y + 100)
Line (X - 100, Y - 100)-(X + 100, Y - 100)
Line (X + 100, Y - 100)-(X + 100, Y + 100)
Line (X - 100, Y + 100)-(X + 100, Y + 100)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询