Hi all, how can I make a context menu appear on a left click? I must be doing it wrong because when I make it appear on a left click it is not lined up properly.
thanks!
Jim
Printable View
Hi all, how can I make a context menu appear on a left click? I must be doing it wrong because when I make it appear on a left click it is not lined up properly.
thanks!
Jim
handle mouse click
check button property
and if on Left click
show the context menu
Yup, got that, but it's placement is not where it should be. Right click puts the context menu at the mouse cursor, but the left click calling the show() method of the context menu places the context menu about 50 pixels down and to the right.
here's my code to intercept the mouse click:
I have also tried it this way with similar results:Code:private void linkLabel_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Drawing.Point p = new Point(this.linkLabel.Size);
this.contextMenu1.Show(this.linkLabel, p);
}
My solution to this problem is to intercept both the left and right clicks so that the context menu placement is the same for both.Code:private void linkLabel_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
System.Drawing.Point p = new Point(this.Cursor.Size);
this.contextMenu1.Show(this.linkLabel, p);
}
Thanks.
Jim