|
-
Feb 13th, 2007, 10:02 AM
#1
Thread Starter
Junior Member
[resolved] context Menu Position in Listview
HI
I want to display the contextMenu once the user right-click in listview,
but I can't make it to the click position.
any idea ?
cms_lvw_product.Show(listView1, new Point(Control.MousePosition.X, Control.MousePosition.Y));
the position is not exactly on the click position.
Last edited by cc96ai; Feb 13th, 2007 at 11:56 AM.
-
Feb 13th, 2007, 10:46 AM
#2
Fanatic Member
Re: context Menu Position in Listview
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Feb 13th, 2007, 11:12 AM
#3
Thread Starter
Junior Member
Re: context Menu Position in Listview
listView1 is the ListView component;
cms_lvw_product is the Context Menu.
listView1.ContextMenuStrip = cms_lvw_product;
listView1.ContextMenuStrip.Visible = true;
however the context menu is still showing up in Right Top corner
appreciate any help.
-
Feb 13th, 2007, 11:23 AM
#4
Fanatic Member
Re: context Menu Position in Listview
where are you assigning the menu better to do it a desgin time or in the constructor of the form, this works for me.
Code:
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
this.listView1.ContextMenuStrip = this.contextMenuStrip1;
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
Useful Links
.Net
#Develop, GhostDoc, CodeKeep , be.PINVOKE, Good Code Snippet Site
Krypton Toolkit, XPCC / XP Common Controls, QSS Windows Forms Components
VB.COM
VB.Classic Help File, MB Controls, MZTools, ADO Stored Procedure Generator add-in,
-
Feb 13th, 2007, 11:30 AM
#5
Thread Starter
Junior Member
Re: context Menu Position in Listview
once you did Right-Click first, it works fine on left/right mouse click
but
If you did Left Click first, then the menu will display in Top/Right corner,
until you click the Right Click, then it become to the correct position.
is a bug there or I should set something up?
otherwise How could I disable LEFT mouse click ?
Last edited by cc96ai; Feb 13th, 2007 at 11:33 AM.
-
Feb 13th, 2007, 11:51 AM
#6
Thread Starter
Junior Member
Re: context Menu Position in Listview
More info:
the problem maybe come with click event ??
private void listView1_Click(object sender, EventArgs e)
{
listView1.ContextMenuStrip = cms_lvw_product;
listView1.ContextMenuStrip.Visible = true;
}
-
Feb 13th, 2007, 11:55 AM
#7
Thread Starter
Junior Member
Re: context Menu Position in Listview
resolved
remove listView1.ContextMenuStrip.Visible = true;
it works fine now
Thx again
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
|