VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Control Array Grids

by Roger Gilchrist (50 Submissions)
Category: Games
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (8 Votes)

What do you do if you need a grid of controls? You can painstakingly draw them one by one in the IDE carefully sizing and placing each one OR use a computer to do it for you!
This demo uses a form with 3 controls on it and a simple procedure (GenerateGrid) to create a program with 3456 (even more if you maximize the form; 16415 dots + the 26 other controls on my system) controls.
To use this code simply create one control with the properties you wish to share (size, colour and shape are the usually ones) and set its Index to 0. This becomes the root control for the array. Place it on the form at the Top-Left position of your grid. Call the routine.
I recommend this for creating tile based games where the positon and contents of the tile are not likely to change most of the time.
While I use it as a graphics display in this demo I do not recommend it because control-based 'pixels' are very slow to create and manipulate as you can see in the demo if you maximize the form (and wait.. and wait... while it creates the controls) .

Rate Control Array Grids

Download Control Array Grids

Download Control Array Grids (3 KB)

Control Array Grids Comments

No comments have been posted about Control Array Grids. Why not be the first to post a comment about Control Array Grids.

Post your comment

Subject:
Message:
0/1000 characters