Rechercher dans la communauté
Affichage des résultats pour les étiquettes 'picturbox'.
1 résultat trouvé
-
Shalut all, je vais vous faire un tuto rapide pour placer une image dans une picturebox, je sais y a l'option padding ou magrin je sais pu.. mais avec on une peu pas mettre une position négative ! pour cela on va faire 2fonctions : #Region "fonctions" Private Function SetPictureAtPoint(ByVal FinalImageSize As System.Drawing.Size, ByVal Image As System.Drawing.Image, ByVal Location As System.Drawing.Point) As System.Drawing.Image Dim TmpImg As System.Drawing.Image = New System.Drawing.Bitmap(FinalImageSize.Width, FinalImageSize.Height) Dim Graphics As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(TmpImg) Graphics.DrawImage(Image, Location) Return TmpImg End Function Private Function SetPictureAtPoint(ByVal Image As System.Drawing.Image, ByVal Location As System.Drawing.Point) As System.Drawing.Image Dim TmpImg As System.Drawing.Image = New System.Drawing.Bitmap(Location.X + Image.Width, Location.Y + Image.Height) Dim Graphics As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(TmpImg) Graphics.DrawImage(Image, Location) Return TmpImg End Function #End Region et puis dans Form.load on va mettre: Dim Img As New Bitmap(My.Resources.bomb) Me.PictureBox1.Image = SetPictureAtPoint(Img, New System.Drawing.Point(0, -20)) donc en rouge votre ressource et en vert la position x,y de votre image. EDIT: petite image cadeau xD pour picturebox de 20Px/20Px Voilà un petit tuto rapide je fais peut-être le refaire mais bon bonne programmation à tous cordialement, Mars