简体   繁体   中英

Adding label to menustrip

Is it possible to add a lable/toostriplabel to a menustrip in ac# winform? I can't find an option to add it dierctly.

I want to add something that describes the status of a program, but I don't want to use a status bar for space.

Simply ToolStripLabel is just a ToolStripItem and MenuStrip.Items is a collection of ToolStripItem so you can just add a ToolStripLabel to MenuStrip normally like this:

menuStrip1.Items.Add(new ToolStripLabel("Status"));

To control the distance between the ToolStripLabel and the Left-side ToolStripItem , you can set the Margin property of your ToolStripLabel , like this:

toolStripLabel1.Margin = new Padding(50,3,3,3);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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