Hello.
I'm making a sort of paint program. To not get it all to buggy and make the users drawings not disapear if you just drag the application window outside the screen, im making a bitmap and drawing to it and then adding it to my picturebox1.backgroundimage.
But it won't let me draw to it more then once. After that I've something stored in my Bitmap I can't draw to it. This is my code:
Thx for reading.
I'm making a sort of paint program. To not get it all to buggy and make the users drawings not disapear if you just drag the application window outside the screen, im making a bitmap and drawing to it and then adding it to my picturebox1.backgroundimage.
But it won't let me draw to it more then once. After that I've something stored in my Bitmap I can't draw to it. This is my code:
VB.NET:
Dim Mbmp As New Bitmap(416, 416)
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Dim myGraphics As Graphics = Graphics.FromImage(Mbmp)
Dim MOUSEy As Integer = MousePosition.Y - MyBase.Location.Y - PictureBox1.Location.Y - 30
Dim MOUSEx As Integer = MousePosition.X - MyBase.Location.X - PictureBox1.Location.X - 4
Label3.Text = MOUSEx & "; " & MOUSEy
myGraphics.DrawRectangle(New Pen(selectedcolor, 1), MOUSEx, MOUSEy, 20, 20)
PictureBox1.BackgroundImage = Mbmp
End Sub
Thx for reading.
Last edited: