用VB怎么实现画图的将鼠标弄成 画笔 那种来画图啊!我看了好多都是说画啥线啊!圆什么的。
2个回答
展开全部
画笔,鼠标移动到哪儿就画到哪儿是吧,以下代码将鼠标移动的路径用线连接起来,形成一条不光滑曲线,和画图工具里面的画笔效果一样。
Dim canpen As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
canpen = True '可以画线的标志
Picture1.CurrentX = X: Picture1.CurrentY = Y '设置起点
Picture1.DrawMode = 13 '画图方式
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 And canpen = True Then
Picture1.Line -(X, Y), Picture1.ForeColor '画线
End If
End Sub
Dim canpen As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
canpen = True '可以画线的标志
Picture1.CurrentX = X: Picture1.CurrentY = Y '设置起点
Picture1.DrawMode = 13 '画图方式
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 And canpen = True Then
Picture1.Line -(X, Y), Picture1.ForeColor '画线
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询