Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Context Menu Seperator

Posted on 2006-07-06
7
Medium Priority
?
475 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
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 375 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

885 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