Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Context Menu Seperator

Posted on 2006-07-06
7
Medium Priority
?
472 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 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