vb画图板直线问题 30

PrivateSubpic2_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)IfButton=... Private Sub pic2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 1 Then '
Select Case graphstyle
Case 2
canline = True
x0 = X
y0 = Y
xnow = X
ynow = Y
pic2.DrawMode = 7
Case 3
canrect = True
x0 = X
y0 = Y
xnow = X
ynow = Y
pic2.DrawMode = 7
Case 4
cancircle = True
x0 = X
y0 = Y
xnow = X
ynow = Y
pic2.DrawMode = 7
Case 1
canpen = True
pic2.CurrentX = X
pic2.CurrentY = Y
pic2.DrawMode = 13
End Select
End If
End Sub

Private Sub pic2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case graphstyle
Case 2
If canline Then
pic2.Line (x0, y0)-(xnow, ynow), Not (pic2.ForeColor)
pic2.Line (x0, y0)-(X, Y), Not (pic2.ForeColor)
xnow = X
ynow = Y
End If
Case 3
If canrect Then
pic2.Line (x0, y0)-(xnow, ynow), Not (pic2.ForeColor), B
pic2.Line (x0, y0)-(X, Y), Not (pic2.ForeColor), B
xnow = X
ynow = Y
End If
Case 4
r0 = Sqr((xnow - x0) ^ 2 + (ynow - y0) ^ 2)
r = Sqr((X - x0) ^ 2 + (Y - y0) ^ 2)
If cancircle Then
pic2.Circle (x0, y0), r0, Not (pic2.ForeColor)
pic2.Circle (x0, y0), r, Not (pic2.ForeColor)
xnow = X
ynow = Y
End If
Case 1
If canpen Then
pic2.Line -(X, Y), pic2.ForeColor
End If
End Select
End Sub

Private Sub pic2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case graphstyle
Case 2
canline = False
pic2.Line (x0, y0)-(xnow, ynow)
pic2.DrawMode = 13
pic2.Line (x0, y0)-(xnow, ynow), pic2.ForeColor
Case 3
canrect = False
pic2.Line (x0, y0)-(xnow, ynow), Not (pic2.ForeColor), B
pic2.DrawMode = 13
pic2.Line (x0, y0)-(xnow, ynow), pic2.ForeColor, B
Case 4
cancircle = False
pic2.Circle (x0, y0), r, Not (pic2.ForeColor)
pic2.DrawMode = 13
pic2.Circle (x0, y0), r, pic2.ForeColor
Case 1
canpen = False
End Select
End Sub

为什么直线画出来会是很多乱线,谢谢各位大侠相助
展开
 我来答
百度网友7c4597b
2015-06-10 · TA获得超过3436个赞
知道大有可为答主
回答量:4928
采纳率:42%
帮助的人:2903万
展开全部

VB6 画图源码 可实现功能 线 圆 矩形 图形移动 颜色 线宽更改 大小更改

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
KL1112
2009-12-25 · TA获得超过532个赞
知道小有建树答主
回答量:454
采纳率:0%
帮助的人:631万
展开全部
你先试试,
在pic2_MouseDown事件中加上pic2.AutoRedraw=False
在pic2_MouseMove事件里代码前面(即Select Case前面)加上pic2.Cls
在pic2_MouseUp事件里代码前面(即Select Case前面)加上pic2.AutoRedraw=True

你再试试...
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
___Exit
2009-12-31
知道答主
回答量:14
采纳率:0%
帮助的人:5.1万
展开全部
画线语句上面加上cls 试试
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式