Hi.
just got .net game programming with DirectX9 and trying to do a simple bit of code drawing a rectangle in a picture box. I've got the following code in the forms paint event.
if you're quick you can see the rectangle but then the picture box is draw over it! I've tried putting this code in the paint event of the picture box but to no avail.Code:Dim graph As Graphics Dim rectSquare As Rectangle Dim graphPath As Drawing2D.GraphicsPath Dim brushSquare As Drawing2D.PathGradientBrush graph = Graphics.FromHwnd(PictureBox1.Handle) 'create a path consisting of one rectangle graphPath = New Drawing2D.GraphicsPath() rectSquare = New Rectangle(10, 20, 23, 27) graphPath.AddRectangle(rectSquare) brushSquare = New Drawing2D.PathGradientBrush(graphPath) brushSquare.CenterColor = Color.FromArgb(255, 0, 255, 0) brushSquare.SurroundColors = New Color() {Color.FromArgb(255, 0, 0, 255)} 'create the rectangle from the path graph.FillPath(brushSquare, graphPath)
Please help! Simple example and I can't get it to work!!!
Nick





Reply With Quote