Help with splitters!

D

Derrick

I have a form with 3 sections in a vertical arrangement. It's starting to
get a little tall, so I want the user to be able to resize the form (using
the border), and have the middle section scroll.

Right now, I have 3 panels: the top panel I want fixed at 75 pixels high,
and docked Top. The bottom panel I also want 75 pixels high, and docked
Bottom. The middle panel should take up the rest (dock Fill), and have it's
autoscroll set to True.

No matter what configuration of panels/splitters, etc., I try, I cannot get
this to work the way I want it. Any hints?

Also, what is a good rule-of-thumb for form sizes - stick with 640x480?

Thanks,

Derrick
 
D

Derrick

Jon Skeet said:
How will that help with WinForms? I don't see anything in the OP's
message saying it was a web page.


Sorry, I should have been more specific. It is indeed Windows Forms, not
webpage. My HTML is just fine :)

What was happening is that after I set the top and bottom panels to Dock Top
and Bottom respectively, I would set the middle panel to Dock Fill. Instead
of filling the middle space like one would expect, the middle panel actually
filled the whole form area, so when I ran and resized the form, you could
see that the top and bottom panels overlapped the scroll bar buttons that I
wanted the user to use. Not cool.

I started a new project, and followed the same steps, but now it works. Go
figure. The only thing I did different was the order in which the panels
were added to the form. Before, I had created the middle panel first, then
added the top and bottom after the fact. This time, I did Top first, then
bottom, then middle.

Sometimes VS.NET amazes me...

Thanks,

Derrick
 
J

Jon Skeet [C# MVP]

Derrick said:
Sorry, I should have been more specific. It is indeed Windows Forms, not
webpage. My HTML is just fine :)

What was happening is that after I set the top and bottom panels to Dock Top
and Bottom respectively, I would set the middle panel to Dock Fill. Instead
of filling the middle space like one would expect, the middle panel actually
filled the whole form area, so when I ran and resized the form, you could
see that the top and bottom panels overlapped the scroll bar buttons that I
wanted the user to use. Not cool.

I started a new project, and followed the same steps, but now it works. Go
figure. The only thing I did different was the order in which the panels
were added to the form. Before, I had created the middle panel first, then
added the top and bottom after the fact. This time, I did Top first, then
bottom, then middle.

Sometimes VS.NET amazes me...

It's not VS.NET particularly in this case - it's the .NET framework. I
believe that the order in which you add controls matters a lot when
dealing with splitters. There's documentation talking about this, but
it's not terribly clear, IMO.
 

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

Top