Jump to content

O utilizador insere a imagem que quer na picturebox, importa a imagem. visual studio 2010


Recommended Posts

Posted (edited)

Tens de inserir um OpenFileDialog no form, e depois metes esse codigo no botão

Dim in_file As String
Dim obj_openfile As New OpenFileDialog

Try
OpenFileDialog1.Filter = "JPEG Files (*.jpg)|*.jpg|RAW Files (*.raw)|*.raw"
OpenFileDialog1.FilterIndex = 1
OpenFileDialog1.Title = "Open Image File"
OpenFileDialog1.Multiselect = True

obj_openfile = OpenFileDialog1

'Show the dialog
If obj_openfile.ShowDialog = Windows.Forms.DialogResult.OK Then
in_file = obj_openfile.FileName.ToString
PictureBox1.Image = Image.FromFile(obj_openfile.FileName)
'Me.PictureBox1.Image = New System.Drawing.Bitmap(in_file)
obj_openfile.Dispose()
obj_openfile = Nothing

Else
Exit Sub
End If

Catch ex As Exception
MsgBox(ex.Message)
End Try
Edited by killerbest

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.