在picturebox作图后怎么保存
在picturebox作图后如何保存?
在picturebox随便画点东西 如何利用savefiledialog保存?
------解决方案--------------------
按PictureBox位置、大小截屏
------解决方案--------------------
代码比较乱,自己看看
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
Dim bmp = New Bitmap(PictureBox1.ClientSize.Width, PictureBox1.ClientSize.Height)
Dim g = Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(Color.Gainsboro), 0, 0, PictureBox1.ClientSize.Width, PictureBox1.ClientSize.Height)
g.DrawLine(New Pen(Color.Blue, 2.0F), 60, 90, 80, 140)
PictureBox1.Image = bmp
bmp.Save(System.Environment.CurrentDirectory & "\MY1.jpg")
Me.PictureBox1.CreateGraphics.DrawLine(New Pen(Color.DarkGray, 3), 37, 40, 80, 60)
Dim p(3) As Point
p(0).X = 100
p(0).Y = 15
p(1).X = 80
p(1).Y = 90
p(2).X = 90
p(2).Y = 120
p(3).X = 130
p(3).Y = 150
Me.PictureBox1.CreateGraphics.DrawPolygon(New Pen(Color.DarkGray, 3), p)
Dim dc1 As Graphics = Me.PictureBox1.CreateGraphics
dc1.DrawLine(New Pen(Color.DarkGray, 3), 37, 140, 180, 60)
g.DrawPolygon(New Pen(Color.DarkGray, 3), p)
g.DrawLine(New Pen(Color.DarkGray, 3), 37, 140, 180, 60)
End Sub
在picturebox随便画点东西 如何利用savefiledialog保存?
------解决方案--------------------
按PictureBox位置、大小截屏
------解决方案--------------------
代码比较乱,自己看看
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
Dim bmp = New Bitmap(PictureBox1.ClientSize.Width, PictureBox1.ClientSize.Height)
Dim g = Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(Color.Gainsboro), 0, 0, PictureBox1.ClientSize.Width, PictureBox1.ClientSize.Height)
g.DrawLine(New Pen(Color.Blue, 2.0F), 60, 90, 80, 140)
PictureBox1.Image = bmp
bmp.Save(System.Environment.CurrentDirectory & "\MY1.jpg")
Me.PictureBox1.CreateGraphics.DrawLine(New Pen(Color.DarkGray, 3), 37, 40, 80, 60)
Dim p(3) As Point
p(0).X = 100
p(0).Y = 15
p(1).X = 80
p(1).Y = 90
p(2).X = 90
p(2).Y = 120
p(3).X = 130
p(3).Y = 150
Me.PictureBox1.CreateGraphics.DrawPolygon(New Pen(Color.DarkGray, 3), p)
Dim dc1 As Graphics = Me.PictureBox1.CreateGraphics
dc1.DrawLine(New Pen(Color.DarkGray, 3), 37, 140, 180, 60)
g.DrawPolygon(New Pen(Color.DarkGray, 3), p)
g.DrawLine(New Pen(Color.DarkGray, 3), 37, 140, 180, 60)
End Sub