11-11-19, 04:49 PM
السلام عليكم
حفظ الصورة بأستخدام SaveFileDialog
طريقة اخرى للحفظ باستخدام SaveFileDialog (من احد امثلة الاخ ramilove)
حفظ الصورة بأستخدام SaveFileDialog
كود :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SaveFileDialog1 As New SaveFileDialog()
SaveFileDialog1.Filter = _
"Image files (*.BMP, *.JPG, *.GIF)|*.bmp;*.jpg;*.gif"
If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
PictureBox1.Image.Save(SaveFileDialog1.FileName)
End If
End Subطريقة اخرى للحفظ باستخدام SaveFileDialog (من احد امثلة الاخ ramilove)
كود :
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Try
' تصدير الصورة
If PictureBox1.Image Is Nothing Then
MsgBox("الصورة غير موجودة ", 16 + 524288, "تنبيه")
Exit Sub
End If
Application.DoEvents()
Dim s As New SaveFileDialog
s.Filter = "Files(*.jpg)|*.jpg"
s.Title = "تصدير صورة"
s.FileName = ""
If s.ShowDialog = System.Windows.Forms.DialogResult.OK Then
'تصير الصورة من بكشر بوكس
Dim bm As New Bitmap(PictureBox1.Image)
bm.Save(s.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)
MsgBox("تم تصدير الصورة بنجاح", MsgBoxStyle.MsgBoxRight + MsgBoxStyle.Information, "تصدير صورة موظف")
s.Dispose()
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
