By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,457 Members | 1,298 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,457 IT Pros & Developers. It's quick & easy.

Size of ToolStrip

P: n/a

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.


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());
}
}
}
Aug 29 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.