this.dataGrid1.CurrentRowIndex=你想要的那个行;这就选中

解决方案 »

  1.   

    方法1、从DataGrid继承,写一个DataGridEx控件,重写OnMouseDown。protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e) 

        DataGrid.HitTestInfo hti = this.HitTest(new Point(e.X, e.Y));
        switch ( hti.Type )
        {
            case DataGrid.HitTestType.Cell:
            {
       switch( e.Button )
       {  
           case MouseButtons.Right:
           {
       return;
           }
           case MouseButtons.Middle:
           {
       return;
           }
           case MouseButtons.Left:
           {
       base.OnMouseDown(e);
       this.SelectRow();    break;
           }
    }
    break;
         }
    }方法2、添加OnMouseDown事件或OnClick事件。在事件中写同样的代码。更多信息:http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp
      

  2.   

    请问thinkingforever,我想用鼠标选中其中的一行,然后操作它,该怎么做呢?谢谢了。
      

  3.   

    用鼠标选中其中的一行
    How can I select the entire row when the user clicks on a cell in the row? 
    http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q689q
      

  4.   

    http//dotnet.aspx.cc/ShowDetail.aspx@id=8ADE535F-AD40-4DE3-A962-A64B4FAF12C4