Reputation: 1869
My form consists of one splitContainer with two horitzontal panels, several buttons on the top panel and charts on the bottom panel.
When the form loads, the top panel is cut and some of the elements are hidden/cut. Moreover if I resize the form, none of the elements or splitContainer resize.
How can properly do it?
I tried with the autoresize property in Form_Load()
//this.AutoSize = true;
//this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
These are the splitContainer properties
//
// 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;
This is the screenshot:
Upvotes: 0
Views: 96
Reputation: 5610
I will recommend putting in a TableLayoutPanel
on the top panel and put buttons in the cells. You can then set resize behaviour of rows and columns in TableLayoutPanel
either percentage or absolute value. Ensure that Dock
property for buttons is set to Fill
. This is will ensure smooth and proper resizing of controls. You can go for similar approach for bottom panel as well.
Upvotes: 0