Dim img As Bitmap = Image ''Déclare une nouvelle image nommée img, inutile car tu peux utiliser directement Image... Dim b As New Bitmap(50, 75) 'Déclare une nouvelle Image Bitmap de 50x75 nommée B Dim g As Graphics = Graphics.FromImage(b) ''Bon ça c'est pour dessiner dans B 'g.DrawImage(img, New Rectangle(0, 0, b.Width, b.Height), New Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel) ''Serait plus correct : g.DrawImage(img, New Rectangle(0, 0, b.Width, b.Height), New Rectangle(0, 0, b.Width, b.Height), GraphicsUnit.Pixel) ''Dessine dans B un 'bout' de l'image IMG de taille 50x75 'b = Image ''B redevient l'image IMAGE donc ce qui était dessiné dessus est effacé et remplacé par l'image 'IMAGE' PictureBox1.Image = b
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim img As Bitmap = Bitmap.FromFile(Application.StartupPath & "\test.jpg") Dim b As New Bitmap(50, 75) Dim g As Graphics = Graphics.FromImage(b) g.DrawImage(img, New Rectangle(0, 0, b.Width, b.Height), New Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel) b.Save(Application.StartupPath & "\test_mini.jpg", Imaging.ImageFormat.Jpeg)
Dim binaires() As Byte = System.Text.Encoding.Default.GetBytes("salut comment ca va?")
Dim b As Bitmap = New Bitmap(50, 75) 'Déclare une nouvelle image nommée b Dim g As Graphics = Graphics.FromImage(b) g.DrawImage(Image.FromFile("image.jpg"), New Rectangle(0, 0, b.Width, b.Height))''Dessine un rectangle composé d'une image de 0;0 à 50;75 PictureBox1.Image = b''Met l'image b dans l'image du picturebox