I need to add multiple shapes to my form during runtime . I would like to add these shapes as a dynamic control array. Any ideas from anyone?? Thanks in advance for any help.
Printable View
I need to add multiple shapes to my form during runtime . I would like to add these shapes as a dynamic control array. Any ideas from anyone?? Thanks in advance for any help.
I need to draw rectangles on the screen at run time - a maximum of 640 of them. The trouble is, they need to fit in with some legacy code from previous versions of the program. :rolleyes:
Basically, depending on the status of a variable in an array, the program needs to be able to draw or remove a rectangle after the user clicks on the appropriate position on the form.
The click-detection code, I can do. Getting the correct place for the rectangle to go (or disappear from), I can do.
Actually getting it to:
a) Draw the right colour rectangle in the right place
b) Remove the CORRECT rectangle after another click
- is beyond me.
HELP! :D
When you want to load another member, use this code:I find this code very useful as it will find the last index in the control array and make one with an index one higher. Then you treat it like a normal control. To be able to do this, set a picturebox (eg. picture1)'s index property to 0. In a command button, run this code and (for example) randomize the left and top, maybe the width and height too.VB Code:
Load Picture1(Picture1.UBound + 1)
You can then save the index of the newly created control, and when it's clicked on again, make it invisible (or unload it)...Cheers!VB Code:
Picture1(ThisIndex).Visible = False Unload Picture1(ThisIndex)
Thanks for the help everyone. Much appreciated