WFA_psychometric_chart.Form1_main.dataGridView1_CellMouseClick C# (CSharp) Method

dataGridView1_CellMouseClick() private method

private dataGridView1_CellMouseClick ( object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e ) : void
sender object
e System.Windows.Forms.DataGridViewCellMouseEventArgs
return void
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                if (e.RowIndex >= 0 && e.ColumnIndex == 0)
                {
                    if (dataGridView1.Rows[e.RowIndex].Cells[0].Value != null)
                    {
                        Point p = new Point(e.X, e.Y);
                        indexSelectedForDeletion = e.RowIndex;
                        //dataGridView1.SelectedCells = true;
                        //DataGridViewCell c = (sender as DataGridView)[e.ColumnIndex, e.RowIndex];
                        //if (!c.Selected)
                        //{
                        //    c.DataGridView.ClearSelection();
                        //    c.DataGridView.CurrentCell = c;
                        //    c.Selected = true;
                        //}
                        //==Calculating the x and y coordinate

                        int xAxis = (int)e.X;
                        //--now alsow count the row index so that yavis = e.y+ (rowIndex*constantMultiple)
                        int rowIndex = dataGridView1.CurrentCell.RowIndex;
                        int yAxis = (int)e.Y+(rowIndex*22);

                        //new Point((int)e.X, (int)e.Y)
                        contextMenuStrip1.Show(dataGridView1, new Point(xAxis, yAxis));
                        //contextMenuStrip1.Show(dataGridView1.PointToScreen(e.Location));
                    }
                }


            }
        }
Form1_main