Autoresize Listbox with Form

  • Thread starter Thread starter Mihai Marinescu
  • Start date Start date
M

Mihai Marinescu

Hi all,
I have 3 Listboxes which i want to resize automatically when the forms
resizes. I played with anchors but when i rersize to much the
listboxes starts to overlap eachother. How can i accomplish to make
something that works well without overlapping ?

Mihai
 
*Mihai Marinescu* tippselte am *19.10.2003 14:24* MESZ:
I have 3 Listboxes which i want to resize automatically when the forms
resizes. I played with anchors but when i rersize to much the
listboxes starts to overlap eachother. How can i accomplish to make
something that works well without overlapping ?

Do you like to have a view like this?

http://great.dynu.com/temp/csharp_listviews.jpg

In that case, set the following properties:

Object - Anchor
~~~~~~~~~~~~~~~

The upper left list view - Top, Bottom, Left, Right
The upper right list view - Top, Bottom, Right
The lower list view - Bottom, Left, Right

HTH,

Michael
 
Yes that's it but i also have a button which is placed between the upper
listboxes and the lower one. What anchor should that one have ?

Mihai
 
*Mihai Marinescu* tippselte am *19.10.2003 17:07* MESZ:
Yes that's it but i also have a button which is placed between the upper
listboxes and the lower one. What anchor should that one have ?

Like this?

http://great.dynu.com/temp/csharp_listviews2.jpg

Set the button's anchor to 'Bottom, Left'.

In case you don't understand the anchor property: It specifies, to which
borders of its container (the control where the relevant control 'lies
in' or 'is a member of') it should hold a constant distance. In your
case you want that the button has always the same x-position (by that,
keeps its distance to the left border of the form) and increases its
y-position if you heighten the form (by that, keeps its distance to the
bottom border of the form).

Best regards,

Michael
 
Lets make this a bit more challenging...

What if the button is between the top two listboxes? That's what I'm
needing and I can't get this to work with the Anchor property.

Suggestions?

Thanks!

Brian
 
You can hook Resize event of the form and set locations / sizes of controls
in there.

HTH
Alex
 
Yes, I agree that will work. However, I'm creating a UserControl and
I would like for the controls to resize at design time when the user
resizes the control on his/her form. The Resize event will not help
me there, will it? Any ideas?

Thanks!

Brian
 
Back
Top