像电脑这种
vb用Shape制作显示鼠标轨迹
- 提问者网友:心牵心
- 2021-05-09 05:10
- 五星知识达人网友:平生事
- 2021-05-09 06:40
把楼上代码稍微改了下。看看吧。只要多加几个Shape就ok
还有把Shape大小换一样的。另外。最好用个图形表示。那效果会好些
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MoveX As Integer, MoveY As Integer
MoveX = X - Shape1.Width / 2
MoveY = Y - Shape1.Height / 2
If (MoveX < 0) Or (MoveX + Shape1.Width > Form1.ScaleWidth) Or (MoveY < 0) Or (MoveY + Shape1.Height > Form1.ScaleHeight) Then
Exit Sub
End If
Shape1.Move MoveX, MoveY
Shape2.Move MoveX + 10, MoveY + 10
Shape3.Move MoveX + 20, MoveY + 20
End Sub
- 1楼网友:从此江山别
- 2021-05-09 07:16
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MoveX As Integer, MoveY As Integer MoveX = X - Shape1.Width / 2 MoveY = Y - Shape1.Height / 2 If (MoveX < 0) Or (MoveX + Shape1.Width > Form1.ScaleWidth) Or (MoveY < 0) Or (MoveY + Shape1.Height > Form1.ScaleHeight) Then Exit Sub End If
Shape1.Move MoveX, MoveY
End Sub
不知道是不是同一个人,这个代码不适合你吗,你用一下再说说想要什么样的