Click to See Complete Forum and Search --> : Drawing controls on a form at runtime like VB does?


Revelate
April 16th, 2001, 09:35 PM
Hello,

I would like to know how you can dynamically add controls to a form by allowing the user to draw the control onto the form like you do in VB when you design a program.

Any help would be appreciated.

Clearcode
April 17th, 2001, 04:36 AM
You need to start with one of each typoe of control with the index 0 on your form.
To add a new control you need to:

Load (TextBoxCtl(TextBoxCtl.Count))




Then you need to simulate the size boxes. I'd suggest picture boxes about 5 pixels square with their background dark blue or black. In the picturebox MouseMove event, if the left button is down, vreate a drag outline and when the button is released resize the control to that outline's size.

HTH,
D.

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com