Chargement image

Résolu
meriemabdelouahab Messages postés 6 Date d'inscription mercredi 13 janvier 2010 Statut Membre Dernière intervention 23 février 2010 - 21 févr. 2010 à 22:48
nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 - 21 févr. 2010 à 23:10
bonjour,j'ai déjà déposé cette question mais je n'ai pas reçu la réponse,je veux parcourir une image dans ma formulaire,voilà le code que j'ai trouvé pour le téléchargement de l'image
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



Try

Dim OpenImg As New OpenFileDialog()
OpenImg.InitialDirectory = Application.StartupPath
OpenImg.Filter = "jpeg files (*.jpg)|*.jpg|PNG (*.png)|*.png|Gif (*.gif)|*.gif"
OpenImg.FilterIndex = 1
OpenImg.RestoreDirectory = True
'affiche l'image sélectionnée
a: If OpenImg.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim MAX_IMAGE_SIZE As Long = 500000
Dim ms As New System.IO.MemoryStream
Dim img As Image

img = New Bitmap(OpenImg.FileName)

img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
If ms.Length > MAX_IMAGE_SIZE Then
MessageBox.Show("La photo ne doit pas depasser 500 ko", "Photo trop grosse", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
GoTo a
End If
Me.PictureBox1.Image = CType(img, Image)


imag.Text = IO.Path.GetFileName(OpenImg.FileName)
Dim image As String = IO.Path.GetFileName(OpenImg.FileName)
'Dim t1 As String = IO.Path.GetDirectoryName(Application.StartupPath)



My.Computer.FileSystem.CopyFile(OpenImg.FileName, "IMAGE_EMPLOYE" + image, True)
t.Text = IO.Path.GetFullPath("IMAGE_EMPLOYE" + image)

End If

Catch ex As Exception
End Try

End Sub
Mais je trouve pas le code de lecture de l'image!!

merci pour votre aide

1 réponse

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 36
21 févr. 2010 à 23:10
Salut,
Me.PictureBox1.Image = New System.Drawing.Bitmap("figure2.bmp")


NB : Titre renommé pas tres explicite comme le contenu de la question!!
3
Rejoignez-nous