dataGrid.select 不就是选取一行么?

解决方案 »

  1.   

    我在代码中gateGrid.select后,在界面中用鼠标点击后选中的是一个cell而不是一整行.
      

  2.   

    datagrid.select(this.datagrid1.currentcell.number)这样就可以了,this.datagrid1.currentcell.number  请查一下DATAGRID控件属性,它指DATAGRID控件里当前选择的索引号,也是行号
      

  3.   

    http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp5.8 How can I select the entire row when the user clicks on a cell in the row?Call the DataGrid.Select method from within its mouseup event.
    [C#]
    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);
              dataGrid1.Select(hti.Row);
         }
    }
      

  4.   

    主要问题是判断鼠标是否双击,请参照http://expert.csdn.net/Expert/topic/1034/1034562.xml?temp=.2088434