如果底层数据不为空的话,XtraGrid一直都会有聚焦行。但您可以从外观上隐藏聚集行的高亮显示。具体实现步骤如下:
1.隐藏指示列或隐藏聚焦行的指示图标
a.要隐藏指示列您可以使用如下代码:
gridView1.OptionsView.ShowIndicator = false;
b.要隐藏聚焦行的指示图标,您可以处理gridView的CustomDrawRowIndicator 事件,如下所示:
private void gridView1_CustomDrawRowIndicator(object sender,
DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) {
e.Info.ImageIndex = -1;
}
2.禁用单元格的聚焦矩形:
gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.None;
3. 禁用GridView.OptionsSelection属性的 EnableAppearanceFocusedCell, EnableAppearanceFocusedRow,及 EnableAppearanceHideSelection 选项:
gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
gridView1.OptionsSelection.EnableAppearanceFocusedRow = false;
gridView1.OptionsSelection.EnableAppearanceHideSelection = false;
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/102.html