急!在线等!Windows窗体程序,如何使DataGrid中第i行第j列的那个Cell处于被选中的状态

解决方案 »

  1.   

    DataGridView.CurrentCell=DataGridView.Rows[i].Cells[j];
      

  2.   

    private void myGrid_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
            {
                System.Drawing.Point pt = new Point(e.X, e.Y); 
                DataGrid.HitTestInfo hti = myGrid.HitTest(pt); 
                if(hti.Type == DataGrid.HitTestType.Cell) 
                { 
                    MessageBox.Show(myGrid[hti.Row, hti.Column].ToString()); 
                } 
            }