07-05-2013, 03:10 PM
Well for something like that you are going to use the VB.NET Graphics object in order to actually draw things directly onto your forms and panels. So, for example, if you wanted to draw a red rectangle on a form, you would need to get a graphics object in order to draw the rectangle. This can be done in some way like this:
[code2=vbnet]Dim g As Graphics = Me.CreateGraphics()
'We can now use "g" to draw anything
'Let's first set everything to red
Dim myBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Red)
g.FillRectangle(myBrush, New Rectangle(0, 0, 200, 300))
myBrush.Dispose()
g.Dispose()[/code2]
The above code creates a graphics object that gets its ability to draw directly from the form, meaning that it will draw directly onto the form. We then set its color to red using a "SolidBrush" object and are able to fill a rectangle by calling the "Fill Rectangle" method. In order to create some sort of gradient effect, this can be done in changing colors while moving down the form using a For Loop or something to the same effect.
[code2=vbnet]Dim g As Graphics = Me.CreateGraphics()
'We can now use "g" to draw anything
'Let's first set everything to red
Dim myBrush As New System.Drawing.SolidBrush(System.Drawing.Color.Red)
g.FillRectangle(myBrush, New Rectangle(0, 0, 200, 300))
myBrush.Dispose()
g.Dispose()[/code2]
The above code creates a graphics object that gets its ability to draw directly from the form, meaning that it will draw directly onto the form. We then set its color to red using a "SolidBrush" object and are able to fill a rectangle by calling the "Fill Rectangle" method. In order to create some sort of gradient effect, this can be done in changing colors while moving down the form using a For Loop or something to the same effect.