Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Right-Click HELP please!

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Right-Click HELP please!
Link Posted: 09-Jul-2007 05:41
This is what finally worked for us:
Grid.MouseDown += new MouseEventHandler(Grid_MouseDown);
Grid.MouseUp += new MouseEventHandler(Grid_MouseUp);

void Grid_MouseDown(object sender, MouseEventArgs e)
{
  if (e.Button != MouseButtons.Right)
    return;

  HitTestInfo ht = Grid.GetHitTestInfoAt(e.Location);

  if (ht.Row < 0)
    return;

  NodeBase rightClickNode = (GridNode)Grid.Rows.GetNodeFromRow(ht.Row);

  if (!rightClickNode.Selected)
  {
    foreach (NodeBase node in Grid.Rows.SelectedNodes)
      node.Selected = false;
  }
}

void Grid_MouseUp(object sender, MouseEventArgs e)
{
  if (e.Button != MouseButtons.Right)
    return;

  if (Grid.RightClickNode != null)
  {
    if (!Grid.RightClickNode.Selected)
      Grid.RightClickNode.Selected = true;

    ShowContextMenu();
  }
}
Link Posted: 01-Oct-2007 01:34
Hey AS. I implemented your solution instead and it works perfectly. Thank you!