Dim fs As FileStream OpenFileDialog1.Filter = "JPG files (*.jpg)|*.jpg|" & "BMP Files (*.bmp)|*.bmp|" _ & "TIF Files (*.tif)|*.tif|" & "PNG Files (*.png)|*.png|" & "ALL Files (*.*)|*.*" OpenFileDialog1.Title = "Select an Image File" If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then currentfilename = OpenFileDialog1.FileName If currentfilename.ToUpper.EndsWith(".JPG") Or _ currentfilename.ToUpper.EndsWith(".BMP") Or _ currentfilename.ToUpper.EndsWith(".TIF") Or _ currentfilename.ToUpper.EndsWith(".PNG") Then If Not (Pic.Image Is Nothing) Then Pic.Image.Dispose() Pic.Image = Nothing End If fs = New FileStream(currentfilename, IO.FileMode.Open, IO.FileAccess.Read) Pic.Image = Image.FromStream(fs) original = Pic.Image End If End If
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)