vb.NET 用GDI+画在PictureBox控件里的图怎么保存

我在PictureBox里画的图该如何保存下来?我先导入了一张图片到PictureBox1.Image想在这张图片的基础上绘制内容,可是保存之后依然之后原先导入的图片,没... 我在PictureBox里画的图该如何保存下来?

我先导入了一张图片到PictureBox1.Image
想在这张图片的基础上绘制内容,可是保存之后依然之后原先导入的图片,没有绘制的内容,我该怎么办?求助!!谢谢!!!好人一生平安!!!!!

附代码:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
PictureBox1.Refresh()
Dim g As Graphics
g = PictureBox1.CreateGraphics
Dim b As New SolidBrush(Color.Black)
Dim f As New Font("全新硬笔行书简", 14.5, FontStyle.Regular)
g.DrawString(TextBox1.Text, f, b, 110, 150)
g.DrawString(TextBox2.Text, f, b, 254, 150)
g.DrawString(TextBox3.Text, f, b, 410, 150)
g.DrawString(TextBox4.Text, f, b, 110, 179)
g.DrawString(TextBox5.Text, f, b, 110, 206)
Dim s As Single
s = Int(Val(TextBox7.Text))
Dim f2 As New Font("全新硬笔行书简", s, FontStyle.Regular)
g.DrawString(TextBox6.Text, f2, b, 158, 255)
Dim f3 As New Font("全新硬笔行书简", 12, FontStyle.Regular)
g.DrawString(TextBox8.Text, f3, b, 52, 452)
g.DrawString(TextBox9.Text, f3, b, 80, 452)
g.DrawString(TextBox10.Text, f3, b, 156, 452)
g.DrawString(ComboBox1.Text, f3, b, 364, 452)
If ComboBox2.Text = "是" Then
g.DrawString(ComboBox2.Text, f3, b, 436, 452)
Else
g.DrawString(ComboBox2.Text, f3, b, 422, 452)
End If
g.DrawString(TextBox13.Text, f3, b, 52, 478)
g.DrawString(TextBox14.Text, f3, b, 80, 478)
g.DrawString(TextBox15.Text, f3, b, 156, 478)
g.DrawString(ComboBox3.Text, f3, b, 364, 478)
If ComboBox4.Text = "是" Then
g.DrawString(ComboBox4.Text, f3, b, 436, 478)
Else
g.DrawString(ComboBox4.Text, f3, b, 422, 478)
End If
g.DrawString(TextBox18.Text, f3, b, 52, 504)
g.DrawString(TextBox19.Text, f3, b, 80, 504)
g.DrawString(TextBox20.Text, f3, b, 156, 504)
g.DrawString(ComboBox5.Text, f3, b, 364, 504)
If ComboBox6.Text = "是" Then
g.DrawString(ComboBox6.Text, f3, b, 436, 504)
Else
g.DrawString(ComboBox6.Text, f3, b, 422, 504)
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox5.Text = Format(Now, "yyyy年MM月dd日")
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
PictureBox1.Refresh()
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
PictureBox1.Image.Save("d:\MF\" & TextBox1.Text & " " & TextBox5.Text & ".jpg")
MsgBox("生成成功!", vbOKOnly, "提示")
End Sub
End Class
展开
 我来答
DoramiHe
2018-04-12 · 知道合伙人互联网行家
DoramiHe
知道合伙人互联网行家
采纳数:25332 获赞数:59542
2011年中山职业技术学院毕业,现担任毅衣公司京东小二

向TA提问 私信TA
展开全部
'添加模块一个模块声明如下APIPublic Declare Function GdiTransparentBlt Lib "gdi32" (ByVal hdc1 As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal W1 As Long, ByVal H1 As Long, ByVal Hdc2 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal W2 As Long, ByVal H2 As Long, ByVal Color As Long) As Long'hdc1 要绘图目标句柄'x1图片显示的横坐标位置'y1图片显示的纵坐标位置'w1图片缩放比例宽度'h1图片缩放比例高度'hdc2要绘制透明色的图片或控件(这里指picture)'x2一般这里填0(图片左上角起始坐标)'y2一般这里填0(图片左上角起始坐标)'w2图片宽度'h2图片高度'color绘制颜色(RGB(255,255,255)为透明色)'picture控件属性设置成visible=falseautosize=trueautoredraw=trueborderstyle=0窗体autoredraw=true简单例子Private Sub Form_Load()GdiTransparentBlt form1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, form1.picture1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, RGB(255, 255, 255) '画图End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式