|
-
October 7th, 2009, 01:38 AM
#1
Context Menu
I have just added contextmenu from the toolbar added its sub item. I build the solution and run it.Nut on right click it is not showing the context menu. Anything else i need to do to show the context menu on right click in the editor. I am a very beginner to C Sharp.please help me.
-
October 7th, 2009, 01:59 AM
#2
Re: Context Menu
did u added menu items to that context menu. other wise u wont see anything after right click .
-
October 7th, 2009, 02:47 AM
#3
Re: Context Menu
 Originally Posted by lion.king
did u added menu items to that context menu. other wise u wont see anything after right click .
i have already added menu item,but i am unable to see.
-
October 7th, 2009, 03:06 AM
#4
Re: Context Menu
You need to show the contextmenu yourself
Code example of showing a contextmenu when the mouse is clicked on a listview
Code:
private void listview1_MouseClick(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Right) {
contextMenu1.Show(listview1, new Point(e.X, e.Y));
}
}
-
October 7th, 2009, 03:11 AM
#5
Re: Context Menu
 Originally Posted by dannystommen
You need to show the contextmenu yourself
Code example of showing a contextmenu when the mouse is clicked on a listview
Code:
private void listview1_MouseClick(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Right) {
contextMenu1.Show(listview1, new Point(e.X, e.Y));
}
}
i am sure in c# or any .net no need of this code. if u added contextmenu to any item, it will be shown on right click.it wont show even when u add it is when u did not add any menu item to that context menu.
-
October 7th, 2009, 03:17 AM
#6
Re: Context Menu
 Originally Posted by lion.king
i am sure in c# or any .net no need of this code. if u added contextmenu to any item, it will be shown on right click.it wont show even when u add it is when u did not add any menu item to that context menu.
You are absolutely right! Missed that property till now..
Any way, to test it, I created a ContextMenuStrip, and set a buttons ContextMenuStrip property to this menustrip. It worked fine.
@bismitapadhi: Did you set this ContextMenuStrip property of the control where you want to show the context menu?
-
October 7th, 2009, 03:25 AM
#7
Re: Context Menu
 Originally Posted by dannystommen
You are absolutely right! Missed that property till now..
Any way, to test it, I created a ContextMenuStrip, and set a buttons ContextMenuStrip property to this menustrip. It worked fine.
@bismitapadhi: Did you set this ContextMenuStrip property of the control where you want to show the context menu?
i haven't seted any control,in properties where i need to set the control.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|