24-06-20, 08:15 PM
(24-06-20, 06:17 PM)alshandodi كتب : السلام عليكم اخوتي الأعزاء انا استخدم هذا الفنكشن لجلب الصوره في بيتشر بوكس هل يمكن التعديل عليه ليجلب أكثر من صيغه
كود :
Public Function GetImage2(path As String) As Image
Dim bmp As Image
Dim fs As New IO.FileStream("Data\" & path & ".jpg|.png", IO.FileMode.Open, IO.FileAccess.Read)
bmp = Image.FromStream(fs)
fs.Close()
fs = Nothing
Return bmp
End Function
Public Sub Loadpicture(ByVal PictureBox1 As PictureBox)
Dim ofd As New OpenFileDialog()
ofd.Title = "Browse Picture"
ofd.Filter = "Image Files(*.BMP; *.JPG;*.GIF;*.PNG)|*.BMP; *.JPG;*.GIF;*.PNG"
If ofd.ShowDialog() = Windows.Forms.DialogResult.OK Then
PictureBox1.Image = Image.FromFile(ofd.FileName)
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End If
End Sub
