F
Fencer
Hello, I have a simple winform application with a MenuStrip, a
StatusStrip, and a RichTextBox. I want to arrange those controls in the
following manner:
MenuStrip on top, default height. Strecth across entire client area width.
StatusStrip on bottom, default height. Stretch across entire client area
width.
In between the MenuStrip and the StatusStrip I want the RichTextBox and
it should fill all remaining space (it should also resize as needed).
I tried the following code which makes use of a TableLayoutPanel:
this.Text = "TableLayoutPanel test";
this.Size = new Size(800, 600);
TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
tableLayoutPanel.Dock = DockStyle.Fill;
tableLayoutPanel.ColumnCount = 1;
tableLayoutPanel.RowCount = 3;
this.MainMenuStrip = new MyMenuStrip();
(MyMenuStrip)this.MainMenuStrip).Create(this);
tableLayoutPanel.Controls.Add(this.MainMenuStrip);
this.textBox.Dock = DockStyle.Fill; // RichTextBox
tableLayoutPanel.Controls.Add(this.textBox);
((MyStatusStrip)this.statusStrip).SetText("Version 0.1");
tableLayoutPanel.Controls.Add(this.statusStrip);
this.Controls.Add(tableLayoutPanel);
However, something is indeed wrong, because the RichTextBox does not
occupy all the remaning vertical space in the client area. I suppose the
cell it's in isn't bigger. Everything else is as it should. How do I fix
this problem?
- Fencer
StatusStrip, and a RichTextBox. I want to arrange those controls in the
following manner:
MenuStrip on top, default height. Strecth across entire client area width.
StatusStrip on bottom, default height. Stretch across entire client area
width.
In between the MenuStrip and the StatusStrip I want the RichTextBox and
it should fill all remaining space (it should also resize as needed).
I tried the following code which makes use of a TableLayoutPanel:
this.Text = "TableLayoutPanel test";
this.Size = new Size(800, 600);
TableLayoutPanel tableLayoutPanel = new TableLayoutPanel();
tableLayoutPanel.Dock = DockStyle.Fill;
tableLayoutPanel.ColumnCount = 1;
tableLayoutPanel.RowCount = 3;
this.MainMenuStrip = new MyMenuStrip();
(MyMenuStrip)this.MainMenuStrip).Create(this);
tableLayoutPanel.Controls.Add(this.MainMenuStrip);
this.textBox.Dock = DockStyle.Fill; // RichTextBox
tableLayoutPanel.Controls.Add(this.textBox);
((MyStatusStrip)this.statusStrip).SetText("Version 0.1");
tableLayoutPanel.Controls.Add(this.statusStrip);
this.Controls.Add(tableLayoutPanel);
However, something is indeed wrong, because the RichTextBox does not
occupy all the remaning vertical space in the client area. I suppose the
cell it's in isn't bigger. Everything else is as it should. How do I fix
this problem?
- Fencer