using DevExpress.XtraGrid.Views.Grid; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Lskj.PubPower { public static class GridExtend { /// /// 说明:设置GridView选中行 /// 创建人:龚宇超 /// 创建日期:2017-12-05 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The grid view. /// The handle. public static void SelectRowHandler(this GridView gridView, int handle) { if (gridView.OptionsSelection.MultiSelect == true && gridView.OptionsSelection.EnableAppearanceFocusedCell == false && gridView.OptionsSelection.MultiSelectMode == GridMultiSelectMode.RowSelect) { if (handle != 0) { gridView.ClearSelection(); gridView.FocusedRowHandle = handle; gridView.SelectRow(handle); } } else { if (handle < 0) handle = 0; gridView.ClearSelection(); gridView.FocusedRowHandle = handle; gridView.SelectRow(handle); } } } }