vb 画矩形问题
谁帮我编下在图片框中根据鼠标拖曳来决定大小画矩形,我做出来的老是在一块区域多画了会某块覆盖区域少掉一段OptionExplicitDimx1AsSingle,y1AsSi...
谁帮我编下在图片框中根据鼠标拖曳来决定大小画矩形,我做出来的老是在一块区域多画了会某块覆盖区域少掉一段
Option Explicit
Dim x1 As Single, y1 As Single, x2 As Single, y2 As Single
Private Sub Form_Load()
DrawMode = 10
AutoRedraw = True
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X: y1 = Y
x2 = X: y2 = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Line (x1, y1)-(x2, y2), , B
x2 = X: y2 = Y
Line (x1, y1)-(x2, y2), , B
End If
End Sub
怎么改覆盖不会出问题 展开
Option Explicit
Dim x1 As Single, y1 As Single, x2 As Single, y2 As Single
Private Sub Form_Load()
DrawMode = 10
AutoRedraw = True
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
x1 = X: y1 = Y
x2 = X: y2 = Y
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Line (x1, y1)-(x2, y2), , B
x2 = X: y2 = Y
Line (x1, y1)-(x2, y2), , B
End If
End Sub
怎么改覆盖不会出问题 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询