1. 设置
千万注意:
要设置成MouseDown,不然会出现一种情况就是双击选中,让用户体验感极差。
DEV19
2. 设置行选中
1 #region gridView选中 2 private void checkbox_checked(DataTable dt1, DataTable dt2) 3 { 4 for (int i = 0; i < dt1.Rows.Count; i++) 5 { 6 string curve_code = dt1.Rows[i]["CURVE_CODE"].ToString().Trim(); 7 string unit_code = dt1.Rows[i]["UNIT_CODE"].ToString().Trim(); 8 for (int j = 0; j < dt2.Rows.Count; j++) 9 { 10 string curve_code_dff = dt2.Rows[j]["CURVE_CODE"].ToString().Trim(); 11 string unit_code_dff = dt2.Rows[j]["UNIT_CODE"].ToString().Trim(); 12 if (curve_code == curve_code_dff && unit_code == unit_code_dff) 13 { 14 this.gridViewDs.SelectRow(i); 15 } 16 } 17 } 18 } 19 #endregion