Dead Girl
Dead Girl

Reputation: 435

How to use Dock-> Fill with an offset?

I have a Windows Media Player-Compononent. I want it to fill the whole form except a line at the bottom for some buttons and Text. So Dock-> Fill minus the part at the bottom but when resized, the part at the bottom should resize to left and right but stay at the bottom and the Windows Media Player-Compononent should resize with the form but keep the distance at the bottom.

Upvotes: 0

Views: 3024

Answers (3)

Snowlove
Snowlove

Reputation: 1

For anyone else having this issue:

I had 2 panels stacked panel1 was fill, panel2 was bottom docked. It looked like it worked but text would appear off panel1 down under panel2.

I fixed this with the padding property. I added 20 padding to the bottom of panel1 and all was fixed.

Upvotes: 0

Sergey Berezovskiy
Sergey Berezovskiy

Reputation: 236218

You don't need any additional Panels or SplitContainers. Problem can be solved with proper docking and anchoring. Place your control on form and resize it so that line at the bottom will stay (you can easily do it by setting dock to top). Then set all anchors of control (How to: Anchor Controls on Windows Forms). That will bound all edges of control to edges of form, and you will have constant height line at the bottom of form.

Result (green is your control):

enter image description here enter image description here

Upvotes: 1

Sriram Sakthivel
Sriram Sakthivel

Reputation: 73462

Add a panel set its dock to Bottom, then add a Media(whatever) component set its dock to Fill. You're done.

Upvotes: 5

Related Questions