sizing controls

  • Thread starter Thread starter ichor
  • Start date Start date
I

ichor

hi
i am developing a c# app and i want that when i size the form the controls
should also be automatically sized.
thanx
 
you will have to handle resize event of the form and make all your control sizes relative to your form size

e.g. button.Width = form1.Width/10
button.Height = form1.Height/10
so whenever you resize the form the controls resize inside the resize event handler of the for

----- ichor wrote: ----

h
i am developing a c# app and i want that when i size the form the control
should also be automatically sized
than
 
You can use the Dock and Anchors properties of the controls and the resize
event of the form.

For example if you have an edit box as large as the form, there is no need
to put the code to resize it in the Resize event, you only have to set the
Anchors properties to Left, Top, Right so the edit box will automatically
keep the distance from the Left, Top and Right borders of the form (and
automatically resize).

You can also play with the Dock property, try it and see what are the
effects.

HTH
Ciao
Formentz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top