【发布时间】:2015-11-10 05:47:52
【问题描述】:
我的表单由一个 splitContainer 和两个水平面板、顶部面板上的几个按钮和底部面板上的图表组成。
当表单加载时,顶部面板被剪切并且一些元素被隐藏/剪切。此外,如果我调整表单大小,则元素或 splitContainer 都不会调整大小。
怎样才能正确做到呢?
我尝试使用 Form_Load() 中的 autoresize 属性
//this.AutoSize = true;
//this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
这些是 splitContainer 属性
//
// splitContainer1
//
this.splitContainer1.BackColor = System.Drawing.SystemColors.ControlDarkDark;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnPlay);
this.splitContainer1.Panel1.Controls.Add(this.grpOptions);
this.splitContainer1.Panel1.Controls.Add(this.grpDisplay);
this.splitContainer1.Panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.splitContainer1_Panel1_Paint);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.splitContainer1.Size = new System.Drawing.Size(784, 561);
this.splitContainer1.SplitterDistance = 69;
this.splitContainer1.TabIndex = 0;
这是截图:
【问题讨论】:
-
the top panel is cut and some of the elements are hidden/cut那是因为您在 splitContainer 中设置了 FixedPanel :this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;删除此行 -
我删除了,但我仍然有同样的行为。
-
Panel1是否调整大小?如果none of the elements or splitContainer resize的问题仍然存在,请包含他们的设计器代码。截图也不错 -
我注意到我可以在加载表单时通过拖动光标来调整 Panel1 的大小。我不想要那个。添加了行为的屏幕截图。