Sequence of Toolstrips

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?

[247 byte] By [HaraldMejlholm] at [2008-1-10]
# 1

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

Citizenontheearth at 2007-10-3 > top of Msdn Tech,Visual Studio Express Editions,Visual C# 2005 Express Edition...