I want to create a Toolstrip and for each ToolStripButton. I also want to create a Toolstrip below the first, in this way each Toolstrip dynamically appear when I click on a ToolStripButton.
I have tried to create the main Toolstrip with Visual Studio designer and for the other toolstrips below I tried to use a customize Toolstrip class. But when I tried to add them:
var cts = new CustomToolStrip();
this.Controls.Add(cts);`
they appeared above of the main Toolstrip.
Here is my CustomToolStrip class:
public class CustomToolStrip : ToolStrip
{
public ToolStripSec()
{
this.GripStyle = ToolStripGripStyle.Hidden;
this.Padding = new Padding(4, 2, 4, 2);
this.AutoSize = true;
this.Dock = DockStyle.Top;
this.Location = new Point(0, 42);
var tspr = new ToolStripProfessionalRenderer();
tspr.RoundedEdges = false;
this.Renderer = tspr;
}
}
Form:
public partial class MainForm : Form
{
public FormAccueil()
{
InitializeComponent(); //this method add the first toolstrip (TSMain)
var r = new ToolStripProfessionalRenderer();
r.RoundedEdges = false;
TSMain.Renderer = r;
var cts = new CustomToolStrip();
this.Controls.Add(cts); // here is the problem
}
}
Result:
http://s16.postimg.org/9kgh0xmh1/Capture.png
Toolstrip 1 and 2 both have the property dock = top.
What can I do to get the Toolstrip 2 below the Toolstrip 1 ?
Could someone guide me please...