用VB编写画图程序
3个回答
展开全部
提供一个绘制任意曲线的简单代码。其他功能类似,希望能举一反三。
在窗体中添加一个Picture box,然后输入命令如下:
Dim oldx As Single
Dim oldy As Single
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then '当鼠标左建按下时发生
Picture1.Line (oldx, oldy)-(X, Y)
oldx = X
oldy = Y
End If
End Sub
Private Sub Picture1_Mousedown(Button As Integer, Shift As Integer, X As Single, Y As Single)
oldx = X
oldy = Y
End Sub
2013-11-29
展开全部
这个问题我之前解答过和你有相同要求的网友 以下是回答的内容 原样给你复制过来的 -------------------------------------------------------------------------------------给你一个VB的代码,是一个简单实现画板的功能,希望可以帮到你。Dim aa As Integer'变量我随便定义的
Dim bb As Integer
Dim cc As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
aa = X
bb = Y
cc = 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If cc = 1 Then
Form1.Line (aa, bb)-(X, Y)
aa = X
bb = Y
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cc = 0
End Sub
Private Sub qk_Click()'清除
Form1.Cls
End Sub
Private Sub tc_Click()'退出
End
End Sub
Dim bb As Integer
Dim cc As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
aa = X
bb = Y
cc = 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If cc = 1 Then
Form1.Line (aa, bb)-(X, Y)
aa = X
bb = Y
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cc = 0
End Sub
Private Sub qk_Click()'清除
Form1.Cls
End Sub
Private Sub tc_Click()'退出
End
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询