Solved

Context Menu Seperator

Posted on 2006-07-06
7
466 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

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

Expert Comment

by:boethius78
ID: 17050382
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
ID: 17050398
For ContextMenu, add an menu with '-' as the text.

Bob
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 125 total points
ID: 17050681
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
ID: 17050838
Yeah, some people really need their hand held, huh?

Bob
0
 
LVL 3

Expert Comment

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

Expert Comment

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

Bob
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

636 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