문제

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top