How will it be possible to add "Gray" lines in a Menu (MenuStrip).
I have attached a picture of how I meen.

Example WordPad in Windows uses these type of menus to separate MenuChoises.

Recommended Answers

All 8 Replies

Possibly in a register entry, that sets it for the whole system.
Which that's a very Windows related question, which you might be better off in a Windows related forum in finding it.
I assume you're trying to alter it for the whole system/user?

Once you find it, just look up how to edit registries with the Windows API in C++.

I am not sure excatly how you meen with a registryentry that sets it for the whole System ?

I think of that you for example can change the rendermode for a menu (System, Proffessional, ManagerRenderMode) on one specific menustrip... in the properties of the menustrip and then I am thinking of that there should also be properties for something like this or something simular ?

Possibly in a register entry, that sets it for the whole system.
Which that's a very Windows related question, which you might be better off in a Windows related forum in finding it.
I assume you're trying to alter it for the whole system/user?

Once you find it, just look up how to edit registries with the Windows API in C++.

You can add those lines in the designer in languages such as VB. Dont know about C++. What are you using? C++ with MFC? Or plain Win32?

Are you designing it visually? or are you doing it all in code

Okay I see, I use Visual C++ 2008 Express Edition and I design the menus visually.
I am searching the properties but are not sure if I can find anything about this.
It is very useful though if you have a lot of things in the menus and want to separate them from eachother :)
I dont know if there is any "command" that you could write in the menu that would create such line like you do for shortcut as &New etc...

You can add those lines in the designer in languages such as VB. Dont know about C++. What are you using? C++ with MFC? Or plain Win32?

Are you designing it visually? or are you doing it all in code

Thank you, that would be the way to do it, however I am not sure how to implement the example into this code.
In the codeView the contextMenu look like this with 2 Items, finishToolStripMenuItem and propertiesToolStripMenuItem

// contextMenuStrip1
// 
this->contextMenuStrip1->AccessibleRole = System::Windows::Forms::AccessibleRole::DropList;
this->contextMenuStrip1->ImeMode = System::Windows::Forms::ImeMode::NoControl;
this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->finishToolStripMenuItem, 
this->insertTickSymbolsToolStripMenuItem, this->toolStripMenuItem2, this->propertiesToolStripMenuItem});
this->contextMenuStrip1->Name = L"contextMenuStrip1";
this->contextMenuStrip1->RenderMode = System::Windows::Forms::ToolStripRenderMode::System;
this->contextMenuStrip1->ShowCheckMargin = true;
this->contextMenuStrip1->ShowImageMargin = false;
this->contextMenuStrip1->Size = System::Drawing::Size(202, 92);
// 
// finishToolStripMenuItem
// 
this->finishToolStripMenuItem->Name = L"finishToolStripMenuItem";
this->finishToolStripMenuItem->Size = System::Drawing::Size(201, 22);
this->finishToolStripMenuItem->Text = L"Insert &Update";
this->finishToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form4::finishToolStripMenuItem_Click);
// 
// propertiesToolStripMenuItem
// 
this->propertiesToolStripMenuItem->Name = L"propertiesToolStripMenuItem";
this->propertiesToolStripMenuItem->Size = System::Drawing::Size(201, 22);
this->propertiesToolStripMenuItem->Text = L"&Properties";

Now with this example, how would I do this break line between these 2 Items ?
The way the Items is implemented is different so I am not sure how to combine them or if I need to exchange the above and rewritten them manually etc..
Example from MSDN:

public:
   void CreateMyMenus()
   {
      // Create three top-level menu items.
      MenuItem^ menuItem1 = gcnew MenuItem( "&File" );
      MenuItem^ menuItem2 = gcnew MenuItem( "&Options" );
      MenuItem^ menuItem3 = gcnew MenuItem( "&Edit" );
      // Place the "Edit" menu on a new line in the menu bar.
      menuItem3->Break = true;
   }
this->finishToolStripMenuItem->Break = true;

I think, basically what ever the handle to the menuoption is, followed by ->break= true

Chris

I cant find Break as member by doing this, but now I know about how to do and focus on, so I will try to check this out. Thanks for help !

this->finishToolStripMenuItem->Break = true;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.