Bonjour,
j'ai été amené à dessiner sur une PictureBox, et je pense que tu devrais essayer ceci :
dans le code de la Form :
1 2 3 4 5
| Private buffer1 As BufferedGraphics
Private Sub picturebox_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles picturebox.Paint
buffer1.Render(e.Graphics)
End Sub |
Dans le Form_Load ou le New :
buffer1 = BufferedGraphicsManager.Current.Allocate(Me.picturebox.CreateGraphics, Me.picturebox.ClientRectangle)
Au moment du dessin (en ayant mis une BackGround image à ton PictureBox) :
1 2 3 4 5 6 7 8 9 10 11 12
| With Me
buffer1.Graphics.Clear(.picturebox.BackColor)
buffer1.Graphics.DrawImage(.picturebox.BackgroundImage, .picturebox.ClientRectangle, New Rectangle(0, 0, .picturebox.BackgroundImage.Width, .picturebox.BackgroundImage.Height), GraphicsUnit.Pixel)
End With
' Dessin.....
With buffer1.Graphics
.DrawLine(....)
End With
buffer1.Render() |
j'espère que cela résoudra ton problème
++
Partager