Visual Basic

  1. Home
  2. Computing & Technology
  3. Visual Basic
The VB.NET Upgrade Wizard
GDI+ ... The "+" means more! A lot more!

Cornell and Morrison say this about GDI+, "Graphics programming in the .NET Framework is totally different than in earlier versions of VB." Hmmm -- where have we heard that before. And why didn't Microsoft's marketing department call it "GDI.NET" like they did everything else?

The Upgrade Wizard doesn't use GDI+ to draw lines so we will have to figure out how to use it ourselves. The only other choice would be to downgrade the quality of our application by doing something second-rate like replacing the win lines with a message box. We won't bother to replace the grid lines until the final, completely rewritten Tic Tac Toe game since the Label controls work fine there.

 Related Resources
• The VB 6 Version:
TicTacToe

• A GDI+ Introduction for Visual Basic 6 Programmers
• A GDI+ Introduction for Visual Basic 6 Programmers
• Source for Upgraded .NET Version
 


Starting with the converted code, notice that the two diagonal win line Label controls (which have been renamed as _linWin_3 and _linWin_4) have been colored red to make sure that we don't overlook the fact that they can't be duplicated in VB.NET. Since we'll have to find a technique to replace the diagonal lines, lets use the same technique for all of the lines. Delete all eight converted win lines in the Forms Designer view, not in the generated support code of the program source.

There's a valuable lesson that you can learn about how VB.NET works as you do this. Before you delete the lines, click on the plus sign to the left of the "Windows Form Designer generated code" to reveal the generated code. You might even want to print the program code so you can do a side-by-side comparision. Then delete the win lines in Forms Designer view and look at the same section of code again. Notice that whole sections have disappeared automatically when the win line label controls are deleted from the form. VB.NET adds and deletes a lot of code automatically. VB 6 never gave you access to this part of the programming but VB.NET does!

A word to the wise! It's a good idea not to change anything in this automatically generated code until you know exactly what you're doing. But if you do have a reason for changing it, it's available to you.

Next page > Conversion Problem Number Two > Page 1, 2, 3, 4, 5, 6, 7, 8, 9

Explore Visual Basic

By Category

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Visual Basic

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.