/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DGV_Inject_MouseUp(object sender, MouseEventArgs e) { DataGridView.HitTestInfo hti; if (e.Button == MouseButtons.Right) { try { hti = DGV_Inject.HitTest(e.X, e.Y); // If cell selection is valid if (hti.ColumnIndex >= 0 && hti.RowIndex >= 0) { DGV_Inject.CurrentRow.Selected = false; DGV_Inject.CurrentCell = DGV_Inject.Rows[hti.RowIndex].Cells[hti.ColumnIndex]; DGV_Inject.Rows[hti.RowIndex].Selected = true; CMS_DataGrid_RightMouseButton.Show(DGV_Inject, new Point(e.X, e.Y)); //CMS_SessionMgmt.Show(DGV_Inject, new Point(e.X, e.Y)); } } catch (Exception) { } } //if (e.Button == MouseButtons.Right) //{ // hitTestInfo = DGV_Inject.HitTest(e.X, e.Y); // // If cell selection is valid // if (hitTestInfo.ColumnIndex >= 0 && hitTestInfo.RowIndex >= 0) // { // DGV_Inject.Rows[hitTestInfo.RowIndex].Cells[hitTestInfo.ColumnIndex].Selected = true; // CMS_DataGrid_RightMouseButton.Show(DGV_Inject, new Point(e.X, e.Y)); // } //} }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DGV_TrafficData_MouseUp(object sender, MouseEventArgs e) { DataGridView.HitTestInfo hitTestInfo; if (e.Button == MouseButtons.Right) { hitTestInfo = DGV_TrafficData.HitTest(e.X, e.Y); // If cell selection is valid if (hitTestInfo.ColumnIndex >= 0 && hitTestInfo.RowIndex >= 0) { //DGV_TrafficData.Rows[hitTestInfo.RowIndex].Selected = true; CMS_DataGrid_RightMouseButton.Show(DGV_TrafficData, new Point(e.X, e.Y)); } } }