How to auto resize controls on the form in Vb.Net?
Hello!
Well I dont know how to explain this but when I resize a form in my application the form resizes without adjusting the controls on it I mean to say that If I have only 2 controls on a form a lable box & 1 textbox.
Lable box is on top & textbox at bottom then if i make the form smaller then the textbox gets dissapered. I want to know how to make these controls to adjust with form resize? I have sen this with many application but don't know how they do this?
Re: How to auto resize controls on the form in Vb.Net?
If you want controls on your form to resize along with the form you'll need to add some code to accomplish this in the Form_Resize event. In your case you could determine the size of the textboxes in proportion to the dimensions of the form and center the command buttons based on their width(s) and the width of the form.
Re: How to auto resize controls on the form in Vb.Net?
All controls have Anchor and Dock properties, which are useful to automatically stretch/align them when the form is resized. You can experiment with the Windows Forms Designer (select a control, go to its properties and set, for example, Anchor to Left, Top, Right, Bottom).
Re: How to auto resize controls on the form in Vb.Net?
Re: How to auto resize controls on the form in Vb.Net?
Hello friends thanks a lot for your replies!
Quote:
All controls have Anchor and Dock properties, which are useful to automatically stretch/align them when the form is resized.
and
Quote:
you'll need to add some code to accomplish this in the Form_Resize event.
I will give it a try!
Thanks for that link too!