固定面板高度在SplitContainer中 [英] Fixed Panel Height in a SplitContainer

查看:1149
本文介绍了固定面板高度在SplitContainer中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

予有含有bindingNavigator在顶部,并与它下面的2 horisontal板一个SplitContainer的一个WinForm。所述的SplitContainer填充未被bindingNavigator占据的空间。

I have a WinForm containing a bindingNavigator at the top and a splitContainer with two horisontal panels below it. The splitContainer fills the space not occupied by the bindingNavigator.

我想底部面板设置为一个固定的高度,例如100像素,并且具有顶板填充空间的其余部分。

这是我目前的code:

This is my current code:

kundeteamSplitContainer.SplitterDistance = kundeteamSplitContainer.Height - 100;

我本来以为这会动态地设置分流器的距离在任何时候都小于总高度100像素,使得底部面板占据了剩余的100个像素。按计划,虽然作为底板不断变化的大小,当我重新大小的形式在运行时这是行不通的。

I would have thought that this would set the splitter distance dynamically to 100 pixels less than the total height at all times, making the bottom panel occupy the remaining 100 pixels. This does not work as intended though as the bottom panel keeps changing size when I re-size the form at run-time.

编辑:我坚持与SplitContainer的,如果在所有可能的。有一堆的功能与隐藏/显示底部面板已经实现了,我不想再这样做的工作。

I am sticking with the splitContainer if at all possible. Got a bunch of functionality related to hiding/showing the bottom panel already implemented and I don't want to do that work again.

推荐答案

正如李:

将<一href="http://msdn.microsoft.com/en-us/library/system.windows.forms.splitcontainer.fixedpanel%28VS.100%29.aspx">FixedPanel属性要保持相同尺寸的面板。

Set the FixedPanel property to the panel you want to remain the same size.

这是这样的:

teamSplitContainer.SplitterDistance = teamSplitContainer.Height - 100;
teamSplitContainer.FixedPanel = FixedPanel.Panel2;

这篇关于固定面板高度在SplitContainer中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆