How to get the left-top point of context menu.

J

Jongmin

Hi everybody,

My task is so simply but I can't.

1. click a menu in context menu
2. create new object such as button
3. set locaction of the object as left-top of contex menu


public System.Windows.Forms.ContextMenu ctxMenu;
private System.Windows.Forms.MenuItem mnuAdd;
..
..
private void mnuAdd_Click(object sender, System.EventArgs
e)
{
System.Windows.Forms.Button button1 = new Button();

// I want use the left-top point of context menu
button1.Location = new Point(120, 345);

button1.Name = "button1";
button1.TabIndex = 0;
button1.Text = "button1";
this.Controls.Add(button1);
}


Thanks,
Jongmin
 
R

Rajesh.V

the mouse down event is fired before the context menu appears. That should
give u this point u want. e.x and e.y
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top