WinForms SplitContainer and its spacing and resizing
让SplitContainer调整我喜欢的方式似乎很麻烦。我有以下称为fr??mMain的形式:
在加载代码的形式中,我必须执行以下代码:
1 2 3 4 5 6 7 8 9 | With MainContainer .IsSplitterFixed = True .Dock = DockStyle.Fill .SplitterDistance = 200 .FixedPanel = FixedPanel.Panel1 .Panel1.BackgroundImage = Resources.My.Resources.ResourceFile._001 .Panel2.BackColor = Color.White .Panel2.AutoScroll = True End With |
运行代码时,我得到以下信息:
我想删除灰色拆分器,因为它没有用。这是常见的美吗
错误,可以将其删除吗?
我的SplitContainer的第二个问题是,如果我调整窗口的大小,Panel1中的backgroundImage和Panel2中的白色不随窗口调整。我上下搜索了"调整大小"代码,但找不到。 Panel2具有用户控件,例如。仪表板和通过以下方式加载:
Panel2是否也可能会自动调整到窗口的宽度,这样您只有一个水平滚动条?
感谢您阅读我的问题,希望您能帮助我解决SplitContainer的问题。祝你今天愉快。
I want to remove the gray splitter since there is no use to it. Is this a common beauty bug and is it possible to remove it?
如果您不希望用户看到或移动拆分器,为什么要使用拆分容器?或者,考虑使用配置有1行和2列的TableLayoutPanel。第一列的绝对宽度为200像素,而第二列的宽度为100%。在两个单元格的每个单元格中,都可以放置一个停靠的面板并将其边距设置为0,0,0,0。
My second problem with the SplitContainer is if I resize my window, the backgroundImage in Panel1 and the white color in Panel2 don't adjust with the window. ... Is it also possible that Panel2 automatically adjusts to the weidht of the window so thay you only have a hortizontal scrollbar?
尽管我没有模拟您当前的解决方案,但是我无法通过快速模拟上面提出的解决方案来复制这些问题。关于自动滚动,滚动条应出现的唯一原因是控件不在屏幕边缘或可用屏幕空间小于面板的最小大小。
您有2个选择:
-
使用
TableLayoutPanel (如@erdomke建议) -
使用2个
Panel 控件
对于2个面板控件,将