Size of ToolStrip

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martijn Mulder

    Size of ToolStrip


    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.Heigh t=89; //does not work
    toolstrip.Dock= DockStyle.Fill; //does not work
    Controls.Add(to olstrippanel);
    }
    }

    static class Program
    {
    [System.STAThrea d]
    static void Main()
    {
    Application.Ena bleVisualStyles ();
    Application.Run (new Form1());
    }
    }
    }
Working...