Solved

Context Menu Seperator

Posted on 2006-07-06
7
426 Views
Last Modified: 2012-06-27
Hi,

try to build a context menu. Now I want to add a menu Seperator and dont't know how ?
               
ContextMenu ctm = new ContextMenu();
ctm.MenuItems.Clear();
ctm.MenuItems.Add("View Trend", new EventHandler(this.OnViewMenuClicked));
ctm.MenuItems.Add("Delete", new EventHandler(this.OnDeleteMenuClicked));
     
Thanks for you help
Martin
0
Comment
Question by:martinmoessner
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

by:boethius78
Comment Utility
Use the ToolStripSeparator control and add to the items as in your code.
0
 
LVL 3

Expert Comment

by:boethius78
Comment Utility
Apologies, I forgot to mention that the ToolStripSeparator will only work with a ContextMenuStrip, not a ContextMenu.

Hope this helps,

b
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
For ContextMenu, add an menu with '-' as the text.

Bob
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 125 total points
Comment Utility
private void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
            {
                  ContextMenu ctm = new ContextMenu();
                  ctm.MenuItems.Clear();
                  ctm.MenuItems.Add("View Trend");
                  MenuItem sepmenuItem=new MenuItem("-") ;
                  sepmenuItem.Enabled=false;
                  ctm.MenuItems.Add(sepmenuItem);

                  ctm.MenuItems.Add("Delete");
                  ctm.Show(textBox1,new Point(e.X,e.Y));
            }
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Yeah, some people really need their hand held, huh?

Bob
0
 
LVL 3

Expert Comment

by:boethius78
Comment Utility
Whoa, you were right.  If I were you, LearnedOne, I'd be quite annoyed at that.
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
I'm not upset, man, it happens all the time ;)

Bob
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now