Home All Groups Group Topic Archive Search About

Best way to implement 2 controls on one window

Author
11 Mar 2006 2:25 AM
Boni
Dear all,
what is the best way to place to controls (listboxes) on the form, so that
the first listbox takes 2/3 of the form and the second 1/3. This proportion
should also stay if window is resized or moved.
Thanks a lot,
Boni

Author
11 Mar 2006 2:00 PM
Boni
Dear all,
may be it was not clear what I want. If you want to full the form with one
control you would normally use form.dock= DockFill. But if there are 2
controls on the form and they must be side/by side and filling the whole
form even if form is resized, what is the best way to implement such
behavoir?
Thanks,
Author
11 Mar 2006 2:11 PM
Armin Zingler
"Boni" <nospam@parampam.pam> schrieb
> Dear all,
> may be it was not clear what I want. If you want to full the form
> with one control you would normally use form.dock= DockFill. But if
> there are 2 controls on the form and they must be side/by side and
> filling the whole form even if form is resized, what is the best way
> to implement such behavoir?
> Thanks,

Set the controls' location and size in the Form's Resize event.


Armin
Author
11 Mar 2006 9:28 PM
gene kelley
On Sat, 11 Mar 2006 15:00:35 +0100, "Boni" <nospam@parampam.pam>
wrote:

>Dear all,
>may be it was not clear what I want. If you want to full the form with one
>control you would normally use form.dock= DockFill. But if there are 2
>controls on the form and they must be side/by side and filling the whole
>form even if form is resized, what is the best way to implement such
>behavoir?
>Thanks,
>

If you want, for example, to have two container type controls on a
form (like panels):
1) Dock one of the Panels, Left, and the other Panel, Right.
2) In the Form's Layout Event add:
    Me.Panel1.Width = 1 + Me.ClientSize.Width \ 2
           Me.Panel2.Width = 1 + Me.ClientSize.Width \ 2


For non-containers, you might look at using the TableLayoutPanel, Dock
Fill,  with 2 coloumns, 1 row, columns @50%.  Drop a control in each
column and set those controls to 'Fill'. 

Gene