all groups > dotnet windows forms > june 2007 >
You're in the

dotnet windows forms

group:

resizing a panel (VS2003)


resizing a panel (VS2003) herc
6/13/2007 2:14:09 PM
dotnet windows forms:
I am drawing a blank here, I have a feeling the solution is beyond
simple, it simply escapes me...

I have a .Net 1.1 form that has a lot of controls on it. Two of the
controls (actually 8 controls are involved total) are list boxes. The
total height of both controls is determined at run time by the form
size. The objective is to make both list boxes 50% of the space.

I say 8 controls because how I have it laid out right now is this:

Main panel contains:
+ Top panel (w/ label and list box) --> Dock: Top
+ Spliter
+ Bottom Panel ( w/ label and listbox) --> Dock: Fill

In .Net 2.0 I would simply use a table control and be done with it,
but it doesn't look like I have that control in .Net 1.1. What is the
best way to make the top panel half the height of the bottom panel?
Also, it is sizable by the user, what is the best approach to
preserving the split location?

Cartoper
Re: resizing a panel (VS2003) herc
6/14/2007 12:18:12 PM
[quoted text, click to view]

This seems to work:

int targetHeight = this.pnlVisitView.Height / 2;
panelVisits.Height = targetHeight - splitterVisitView.Height;
panelViews.Height = targetHeight;
panelViews.Top = targetHeight;

AddThis Social Bookmark Button