Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDraw a background grid on a form in Visual Basic 2005
DescriptionThis example shows how to draw a background grid on a form in Visual Basic 2005.
Keywordsbackground grid, grid, form, BackgroundImage, VB 2005
CategoriesControls, Graphics
 
Thanks to Patrik.

This example displays a light colored grid on a dark background.

When the form loads, the code calls a routine that builds a grid image and saves it in a bitmap. The grid image is only big enough to show one "square" in the grid so it doesn't take much memory.

The program sets the form's BackgroundImage property to this bitmap. That property is automatically repeated as necessary to tile the form so (1) the program doesn't need to make a big grid to cover the form and (2) if the form resizes it automatically covers the form with the tile.

See the code for details.

 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated