Why does it seem that when you know how to do something, then that control is taken away for "ease of use", it just seems harder?
Im trying to do a double buffer to my picturebox. Currently Im having no problem drawing 50+ shapes to the picturebox, but I want everything to appear at once. This was pretty easy in VB6, you just used a double buffer and flipped it.
Ok, I have to do things the .Net way (or at least learn how).
I saw another post about this and I found out that .Net does it for you, if you jump through its hoops ::groan::
Ok, so I read that you needed to turn on DoubleBuffer and AllPaintingInWmPaint on, which I believe I did here:
I call this procedure on form load.
I read that you have to do all of your drawing in the Paint or OnPaint Methods, using e for all of your drawing.
This is my attempt:
This actually draws a gameblock on my picturebox (picScreen).
My main problem is that I have all of this bitmap info in a class, in which I normally pass the picturebox reference across. If the drawing has to be done from e.graphics, can you just pass the e across instead of the picturebox?
Im trying to do a double buffer to my picturebox. Currently Im having no problem drawing 50+ shapes to the picturebox, but I want everything to appear at once. This was pretty easy in VB6, you just used a double buffer and flipped it.
Ok, I have to do things the .Net way (or at least learn how).
I saw another post about this and I found out that .Net does it for you, if you jump through its hoops ::groan::
Ok, so I read that you needed to turn on DoubleBuffer and AllPaintingInWmPaint on, which I believe I did here:
Code:
Sub EnableDoubleBuffering()
Me.SetStyle(ControlStyles.DoubleBuffer _
Or ControlStyles.UserPaint _
Or ControlStyles.AllPaintingInWmPaint, _
True)
Me.UpdateStyles()
End Sub
I call this procedure on form load.
I read that you have to do all of your drawing in the Paint or OnPaint Methods, using e for all of your drawing.
This is my attempt:
Code:
picScreen_Paint(ByVal sender as object, ByVal e as System.Windows. Forms.PaintEventArgs) Handles picScreen.Paint
Dim g as graphics = e.graphics
dim bmap as Bitmap
bmap = new Bitmap(FilePath)
dim Rect as Rectangle
Rect = new Rectanble(0,0,16,16)
g.drawimage(bmap, rect, 0,0,16,16, GraphicsUnit.Pixel)
End Sub
This actually draws a gameblock on my picturebox (picScreen).
My main problem is that I have all of this bitmap info in a class, in which I normally pass the picturebox reference across. If the drawing has to be done from e.graphics, can you just pass the e across instead of the picturebox?