locked
Sequence of Toolstrips RRS feed

  • Question

  • If I have multiple ToolStrips in f.ex. the TopToolPanel of a ToolStripContainer, how do I control (from the program) the sequence in which they appear? And also whether they appear beside each other (if space available) or top-down?

    Tuesday, September 25, 2007 9:30 AM

Answers

  • Hi harald,

     

    If you have multiple ToolStrips in the TopToolPanel of a ToolStripContainer, you can try the following sample codes to control the sequence in which they appear:

    toolStripContainer1.TopToolStripPanel.Controls[index].Visible

    or

    toolStripContainer1.TopToolStripPanel.Controls[index].Show()/Hide()

     

    For example, if you would like to allow three ToolStrips to appear according to ToolStrip3,ToolStrip1,ToolStrip2, you can try the following sample codes:

    Code Block

    toolStripContainer1.TopToolStripPanel.Controls[2].Visible = true;
    toolStripContainer1.TopToolStripPanel.Controls[0].Visible = true;

    toolStripContainer1.TopToolStripPanel.Controls[1].Visible = true;

     

     

    If you would like to control the location of the ToolStrips in the TopToolPanel of a ToolStripContainer, you can try to use toolStripContainer1.TopToolStripPanel.Controls[index].Location/

    toolStripContainer1.TopToolStripPanel.Controls[index].Left/

    toolStripContainer1.TopToolStripPanel.Controls[index].Top

     

    Try to check out this MSDN document for more information about ToolStrip class -  http://msdn2.microsoft.com/en-us/library/system.windows.forms.toolstrip(vs.80).aspx

     

    Hope this helps,

     

    Regards,

    Citizens on the earth

    Thursday, September 27, 2007 8:10 AM