图片框图画图象

时间:2016-09-06 04:37:01

标签: .net vb.net picturebox

我有一个问题。是否可以保存图片框的绘图图像?

因为我有一个系统,用户将使用pentablet登录图片框或者说鼠标。然后,用户可以将此图像保存为其签名。

这是我的输出。只是图片框内的油漆: enter image description here

是否可以将此绘图图像另存为jpeg?如果是这样的话呢?

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

这就是我将图片框中的绘画保存为imgae的方法,但是在.png文件中。

Private Sub ts_btnSave_Click(sender As Object, e As EventArgs) Handles ts_btnSave.Click
    If Detector = 0 Then 'Detectore here is a variable where an identifier to inform me if the user paint something in picturebox or not.
        MessageBox.Show("No Signature Found", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error)
    Else
        If MessageBox.Show("Are you sure you want to save?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) = vbYes Then
            Dim bmp As New Bitmap(PictureBox1.Width, PictureBox1.Height)
            PictureBox1.DrawToBitmap(bmp, New Rectangle(0, 0, PictureBox1.Width, PictureBox1.Height))
            bmp.Save("D:Images\Filename.png", Imaging.ImageFormat.Png) 'File name must be flexible so that it will not replace the old image.
            bmp.Dispose()
            Me.Dispose()
        End If
    End If
End Sub

最好的问候@jmcilhinney努力

相关问题