Graphics is the hardest thing to convert from
VB 6 to
VB .NET. For a lot of information about using graphics in .NET, see my Wrox Blox:
Visual Basic Graphics Programming
http://www.wrox.com/WileyCDA/WroxTit...470343486.html
It provides a good introduction for only $6.99.
The key ideas are:
There is a PictureBox control but it doesn't provide drawing methods. Instead it can either display an image or draw in its Paint event handler. (The Form can do the same).
The Paint event handler provides a Graphics object, and that object provides drawing methods such as DrawLine and FillRectangle. You can think of the Graphics object as the surface on which you draw.
You can also get a Graphics object by creating a Bitmap like this:
Code:
Dim bm As New Bitmap(100, 100)
Dim gr As Graphics = Graphics.FromImage(bm)
gr.DrawLine(Pens.Red, 0, 0, 100, 50)
You use Pen objects to determine how lines are drawn. For example, to set their color, thickness, dash styles, etc.
You use Brushes to determine how areas and text are filled. For example, to set their color and fill pattern.
That's the extremely quick overview. Search online for more examples. The
VB Helper web site has lots of graphics examples. Try looking at:
http://www.vb-helper.com/index_graphics.html
Of look at that Wrox Blox I mentioned, or read the chapters about graphics in this forum's book
Visual Basic 2010 Programmer's Reference.
Finally if you get stuck and need a hint, post a new question here or email me directly (RodStephens@
vb-helper.com).
Good luck!