Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize a control

Status
Not open for further replies.

Flupke

Programmer
Jun 26, 2002
94
BE
Hello,

In a VB.NET 2005 project, I created a control of my own which contains buttons, panels and textboxes.
When I put that control on a form, how can I be sure that all the controls will be resized correctly to the size of the control?
I did put some code in the resize-event of the control, but when the program starts, the control does not appear om my form.
Do you have any suggestion?

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel
 
NOoo,

Take a look at "Dock" and "Anchor" properties. (of every control)
Also you must check the CONTROL's maximumsize and minimumsize!

 
Can you enlighten that for me, please. I thought the dock-property could only put the control on a side or in the middle of a form.
Can you maniputlate the dock- and anchor property through code in a for-next-loop, in which all the controls on this form are treated?

Thanks for your help,

Michel
 
Are you going to create programmatically other controls (textbox, button, etc) ?

The Dock property : Can be set to top, botton, right, left, fill and none. The 4 first will tell the control to grab from this side. Eg. If set to right, it will grab the right side and will 'touch' the top and bottom side.

The Anchor property has combinations of {up, down, right and left}. The control will stretch (down and/or right)...
Just apply it and resize the control form. The results are visible nad on design time.

* If you want a control (button for example) to be centred and not stretched, select it, place it on center (using control alignment from VS toolbar) and set anchor to none.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top