PC Review


Reply
Thread Tools Rate Thread

how to add sub-items to context menu items

 
 
weird0
Guest
Posts: n/a
 
      22nd Nov 2007
private void treeView1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right) // detect Right
click
{
TreeNode selectedNode = treeView1.GetNodeAt(e.X,
e.Y);
ContextMenu cMenu = new ContextMenu();
MenuItem menuItem = new MenuItem("Set Evidence",new
EventHandler(popup));
// want to add two sub-items Item1 and Item2 .... How ?
cMenu.MenuItems.Add(menuItem);
cMenu.Show(this,new Point(e.X+50,e.Y+30));

}
}
 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      22nd Nov 2007
You can access the MenuItems property on the MenuItem instance.


--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"weird0" <(E-Mail Removed)> wrote in message
news:10435638-c712-40ec-93af-(E-Mail Removed)...
> private void treeView1_MouseDown(object sender, MouseEventArgs e)
> {
> if (e.Button == MouseButtons.Right) // detect Right
> click
> {
> TreeNode selectedNode = treeView1.GetNodeAt(e.X,
> e.Y);
> ContextMenu cMenu = new ContextMenu();
> MenuItem menuItem = new MenuItem("Set Evidence",new
> EventHandler(popup));
> // want to add two sub-items Item1 and Item2 .... How ?
> cMenu.MenuItems.Add(menuItem);
> cMenu.Show(this,new Point(e.X+50,e.Y+30));
>
> }
> }


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add items to context menu Fred Jacobowitz Microsoft Excel Worksheet Functions 1 22nd Apr 2006 10:29 PM
To restore menu items of context menu in IE after adding custom items vicsmith@yandex.ru Windows XP Internet Explorer 0 26th Sep 2005 03:52 AM
To restore menu items of context menu in IE after adding custom items vicsmith@yandex.ru Windows XP Internet Explorer 0 21st Sep 2005 09:58 AM
right context menu items Ranjit Windows XP General 2 2nd Apr 2004 03:02 PM
Can't add items to NEW context menu help! win2k user Microsoft Windows 2000 0 26th Nov 2003 12:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:43 AM.