menustrip

How to Add Sub Items to a MenuStrip's ToolStripMenuItem in C#

荒凉一梦 提交于 2020-06-12 05:48:25
问题 I have added a menustrip1 into my windows form and I statically added one toolstripmenuitem (WindowstoolStripmenuItem) to that menustrip1 . And I have created a toolstripmenuitem dynamically. I want to add this dynamic toolstripmenuitem to the static menustripitem(WindowstoolStripmenuItem) which is created statically on design time. ToolStripMenuItem itm = new ToolStripMenuItem(); itm.Name = "fm1"; itm.Text = "Form1"; How can I add this subitem to the static menustrip's Windows item. 回答1: You

Windows Forms MenuStrip Border Color

霸气de小男生 提交于 2020-04-30 07:38:45
问题 I am making app in Windows Forms. I've added MenuStrip and changed it colors using ToolStripProfessionalRenderer. The problem is that whenever I am trying to change dropdown border color it only changes the outside border ( image below ). How can I change the remaining white border that still is visible inside? Or how to just disable border there? 回答1: All you have to do is to override properties that you need to set the color. This article will help you to do that. And this is another link

C# how to change menuStrip hover color? [duplicate]

﹥>﹥吖頭↗ 提交于 2020-03-06 03:02:55
问题 This question already has answers here : How to change menu hover color (4 answers) Change the border color of Winforms menu dropdown list (4 answers) Closed 3 years ago . Good day people, I want to change the color of a menu item on my menuStrip when I hover above it. Can anyone help me? 回答1: You can't do this using the normal MouseEnter and MouseLeave events. You need to directly override the menu rendering. You can do something like this, using the MenuStrip class: private class renderer :

Getting the Left and Right arrow keys to select the previous/next menu instead of the next/previous menu

佐手、 提交于 2020-01-23 11:08:32
问题 Noticed in a full application, but fully reproducable in a simple demo: I've got a MenuStrip containing three menus, A , B , and C . Each of these menus contains three items, A1 / A2 /.../ C2 / C3 . When I press Alt , the first menu A becomes selected. I can then use the ← and → keys to select other menus. That is as it should be. However, when I press ↓ to open a menu, I can still use ← and → to select other menus, but the order is reversed: ← selects the next menu, and → the previous. I'm

Grey out menustrip items when certain forms are open/active/focused

谁说我不能喝 提交于 2019-12-24 23:25:43
问题 On my parent form i have a menustrip. I disabled (Enabled=false) some options by default. However i cannot access the menu from the child where i need to enable these items. I tried a lot of variations like this in the child form constructor: string[] visibleItems = new[] { "Export", "Import" }; foreach (ToolStripMenuItem item in MdiParent.MainMenuStrip.Items) //base.MainMenuStrip.Items, MainMenuStrip.Items, base.Menu.MdiListItem.MenuItems won't work either. { if (visibleItems.Contains(item

ToolStrip vs MenuStrip - can I make their rendering identical?

旧街凉风 提交于 2019-12-24 16:20:56
问题 I need to display a toolstrip directly beneath a menustrip in my application, but setting RenderMode = Professional for each does not give identical results. They both show a background gradient, but not the same one. Is there some way to use menustrip rendering for the toolstrip, or vice versa? Or can someone advise how best to implement a gradient myself, that I can perform in a sub-classed renderer? ADDED LATER: Many thanks to nobugz for his answer below. Helpful material is also in this

Parent form is bringing to front when the menu strip of a child form is clicked

可紊 提交于 2019-12-24 13:04:22
问题 I have a pretty strange but reproductible problem. I have a MenuStrip which can open a new Modeless form with the Form.Show() method. The child form also have a Menu Strip. The strange stuff happens when you start by clicking the menu strip of the child form. Then the parent form is coming back foreground and saying hello. That's a real pain. How to prevent this problem? A Scorcese movie to illustrate my problem by following this link zippyshare.com (3Mo) As you can see in the video, parent

How to find toolstripmenuItem with name

十年热恋 提交于 2019-12-24 03:31:06
问题 I have set visible property of my menuStrip1 items to false as foreach (ToolStripMenuItem itm in menuStrip1.Items) { itm.Visible = false; } Now I know the Names of toolStripMenuItem and dropDownItem of the menustrip1. How to can I activate the required toolStripMenuItem and dropDownItem . I have string mnItm = "SalesToolStripMenuItem"; string ddItm = "invoiceToolStripMenuItem"; Now I want to set visible true to these two( toolStripMenuItem and dropDownItem ) items. How can I do that? I know

Foreach every Subitem in a MenuStrip

笑着哭i 提交于 2019-12-22 06:41:34
问题 I want to get all the SubItems of my MenuStrip , So I can change them all at once. I'am trying things like the following, but they aren't working: foreach (ToolStripMenuItem toolItem in menuStrip1.DropDownItems) { //Do something with toolItem here } Can someone help me out coding a good foreach loop for getting all the SubMenuItems(DropDownItems) from the MenuStrip ? EDIT now trying to work with the following Recursive method : private void SetToolStripItems(ToolStripItemCollection

Winform menustrip and hiding tabs

╄→гoц情女王★ 提交于 2019-12-20 06:21:57
问题 Hello I'm thinking of creating a tabcontrol which the tabpages will be filtered by the clicks in the menustrip. For ex. My menustrip is in form 1 and my tabcontrol is in form 2 My tabcontrol consist of 7 tabs and I want only 1 tab will be shown at a time. for example If I click the name in the menustrip it will open/show a new form and the tabcontrol will only show the names tab. I wonder if its possible because making diff forms for each list seems to be very long. thanks for reading this.