简体   繁体   English

如何在Windows窗体主菜单控件的顶部显示控件?

[英]How to make a control display on top of a Windows Forms Main Menu control?

I'd like to place a control on top of the MainMenu control, however the designer won't let you move controls on top of the MainMenu control. 我想在MainMenu控件的顶部放置一个控件,但是设计者不会让您将控件移到MainMenu控件的顶部。

Is there another way to achieve this? 还有另一种方法可以做到这一点吗?

Set Control properties as 将控件属性设置为

  control.Dock = DockStyle.Top;
  control.SendToBack();

Turns out the MainMenu control does't support this behaviour, but using a MenuStrip control (introduced in .net 2.0) supports this behaviour. 事实证明MainMenu控件不支持此行为,但是使用MenuStrip控件(在.net 2.0中引入)可以支持此行为。

So I just needed to change the control to the new type to get this to work. 因此,我只需要将控件更改为新类型即可使其正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM