all groups > dotnet windows forms > april 2006 >
You're in the

dotnet windows forms

group:

User control


User control Pesso
4/29/2006 12:39:15 AM
dotnet windows forms:
I have a user control in which contains a Label, a Toolbar and a TabControl.
When the User control is resized I like to resize the controls inside the
User control. How do I do that?

--
pesso

Robotics
http://www.robotics.com/robots.html

C++ to HTML Converter
http://www.codesolutions.net

Re: User control andrej.tozon NO[at]SPAM gmail.com
4/29/2006 1:41:46 AM
Set the Anchor property of the controls you want to resize withing the
parent user control.
Re: User control Michael Powell
4/29/2006 2:46:07 PM
Hi,
If you want all of your controls to resize you can set their sizes in the
OnSizeChanged method, you should set their sizes to a percentage of the
ClientRectangle, this means that they will always be proportionately the
same.

The problem with using the anchors is that it uses Rectangles so its always
an integer value so you get ugly jerking resizing of your controls, you
should also turn off the SnapToGrid property

Note: You should define where you want them by calculating RectangleF s and
then set the rectangle for each of your controls to one of these
RectangleF's

--
Mike Powell
Ramuseco Limited
www.ramuseco.com
[quoted text, click to view]

AddThis Social Bookmark Button