Simple context menu problem

  • Thread starter Thread starter Striped
  • Start date Start date
S

Striped

What's wrong with the context menu?

I have created one for the DataGrid control and showing it like this:

private void dataGrid_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if( e.Button == MouseButtons.Right)
{
if( dataGrid.ContextMenu != null )
dataGrid.ContextMenu.Show(dataGrid, new Point(e.X, e.Y) );
}
}

The menu is displayed but I need to click TWICE to dismiss it!
Is it intended to be like that?
 
Striped said:
What's wrong with the context menu?

I have created one for the DataGrid control and showing it like this:

private void dataGrid_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs e)
{
if( e.Button == MouseButtons.Right)
{
if( dataGrid.ContextMenu != null )
dataGrid.ContextMenu.Show(dataGrid, new Point(e.X, e.Y) );
}
}

The menu is displayed but I need to click TWICE to dismiss it!
Is it intended to be like that?

I believe that once the menu is assigned to the DataGrid's ContextMenu
property it will automatically be popped up in response to a right-mouse
click, so you don't need to handle the MouseUp event and show the menu
yourself.(I admit that this is NOT what the online help says, but it seems
to work!)

Chris Jobson
 

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

Back
Top