I have a toolstrip container with two toolstrips. I want to force one of them to be displayed on top of the other. I tried setting Dock to Top for one and to Bottom for the other, but they are still displayed randomly. I also tried using TopToolStripPanel.Controls.SetChildIndex(...) but it didn't have an effect. Even the same executable on two different pc's gives different order. Is there a way to force the order? Thanks
Add these lines of code after InitializeComponent();
to your form's constructor to ensure your specific order. This fixes any messed up settings in the designer generated code:
toolStripContainer1.TopToolStripPanel.SuspendLayout();
toolStrip1.Dock = DockStyle.None;
toolStrip2.Dock = DockStyle.None;
toolStrip1.Location = new Point(0, 0);
toolStrip2.Location = new Point(0, toolStrip1.Height);
toolStripContainer1.TopToolStripPanel.ResumeLayout();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With