求一个用VB.NET做的画图程序 真心急 谢谢各位大神了 或者懂的指导一下也行啊
1个回答
展开全部
。。我这有
这是 visual studio 2010
Public Class Form1
Inherits System.Windows.Forms.Form
Private mygraphic As Graphics '定义画布
Private mypen As New Pen(Color.Blue, 4) '定义画笔
Private x, y As Integer '记录坐标点的(x,y) 坐标点
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.BackColor = Color.White '定义 背景色 为白色
mygraphic = PictureBox1.CreateGraphics
x = 0
y = 0
End Sub
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
x = e.X
y = e.Y
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If e.Button = MouseButtons.Left Then '如果左键按下
mygraphic.DrawLine(mypen, x, y, e.X, e.Y) ' 会直线条
x = e.X '将下一条线的起始设置为上一条线的终点
y = e.Y
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mygraphic.Clear(Color.White)
End Sub
End Class
这是 visual studio 2010
Public Class Form1
Inherits System.Windows.Forms.Form
Private mygraphic As Graphics '定义画布
Private mypen As New Pen(Color.Blue, 4) '定义画笔
Private x, y As Integer '记录坐标点的(x,y) 坐标点
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.BackColor = Color.White '定义 背景色 为白色
mygraphic = PictureBox1.CreateGraphics
x = 0
y = 0
End Sub
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
x = e.X
y = e.Y
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If e.Button = MouseButtons.Left Then '如果左键按下
mygraphic.DrawLine(mypen, x, y, e.X, e.Y) ' 会直线条
x = e.X '将下一条线的起始设置为上一条线的终点
y = e.Y
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mygraphic.Clear(Color.White)
End Sub
End Class
更多追问追答
追问
大哥 有没有做完的程序 光给我这个我还是做不了 不清楚 我一弄全是错误都不知道哪里错了
追答
好的 我 直接 加附件 吧 你邮箱 发我???
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询