Microsoft Visual Basic 2005 Step by Step (Step by Step (Microsoft))
Chapter 15 Quick Reference
To | Do this |
Create lines or shapes on a form | Use methods in the System.Drawing.Graphics namespace. For example, the following program statements draw an ellipse on the form:
Dim GraphicsFun As System.Drawing.Graphics GraphicsFun = Me.CreateGraphics Dim PenColor As New System.Drawing.Pen _ (System.Drawing.Color.Red) GraphicsFun.DrawEllipse(PenColor, 10, _ 120, 200, 160) |
Create lines or shapes that persist on the form during window redraws | Place the graphics methods in the Paint event procedure for the form. |
Move an object on a form | Relocate the object by using the Location property, the New keyword, and the Point structure. For example:
PictureBox1.Location = New Point(300, 200) |
Animate an object | Use a timer event procedure to modify the Left, Top, or Location properties for an object on the form. The timer's Interval property controls animation speed. |
Expand or shrink an object at run time | Change the object's Height property or Width property. |
Change the transparency of a form | Change the Opacity property. |