Size of ToolStrip

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());
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top