就是dbGrid.CurrentRowIndex,你在试吧

解决方案 »

  1.   


    private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) 
     { 
          System.Drawing.Point pt = new Point(e.X, e.Y); 
          DataGrid.HitTestInfo hti = dataGrid1.HitTest(pt); 
          if(hti.Type == DataGrid.HitTestType.Cell) 
          { 
               dataGrid1.CurrentCell = new DataGridCell(hti.Row, hti.Column); 
               LineNum=hti.Row; 
          } 
     } 
    LineNum就是行号了
      

  2.   

    我在datagrid的mousedown时间里面得到的dbGrid.CurrentRowIndex怎么是上一次点击的行的行号呀?我怎么得到本次点击的行的行号?
      

  3.   

    dplxp(绝尘一骑) 说的非常的正确,我前几天还看到这个方法呢,今天都忘记,愚蠢呀!我再问一个问题,如果我点击的行换了比如说从第一行换到了第二行,就比如说行的焦点发生了变化将会触发什么时间?
      

  4.   

    CurrentCellChanged event
    不行吧?这个cell改变的时候就触发呀,在同一行的不同的cell上移动光标的时候也是会触发!