Size of ToolStrip

  • Thread starter Thread starter Martijn Mulder
  • Start date Start date
M

Martijn Mulder

The ToolStrip on top of my form is to small. I want to increase its
height. Simply setting the Height-property doesn't change the height,
though. So I tried to place the ToolStrip in a ToolStripPanel, that does
react to changes in its Height-property, and by setting the
Dock-property of the contained ToolStrip to DockStyle.Fill, I expected
the ToolStrip to fill the entire ToolStripPanel. Nope. See the code
below, it is ready to run.



Code Snippet


namespace Namespace1
{

using System.Windows.Forms;

class Form1:Form
{

public Form1()
{
Text="How to expand a ToolStrip?";
ToolStripPanel toolstrippanel=new ToolStripPanel();
ToolStrip toolstrip=new ToolStrip
(
new ToolStripButton[]
{
new ToolStripButton("One"),
new ToolStripButton("Two"),
new ToolStripButton("Three"),
}
);
toolstrippanel.Height=89;
toolstrippanel.Join(toolstrip);
toolstrip.Height=89; //does not work
toolstrip.Dock=DockStyle.Fill; //does not work
Controls.Add(toolstrippanel);
}
}

static class Program
{
[System.STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
}
 
Back
Top