下面的示例展示了如何在布局视图中改变获得焦点的和未获得焦点的卡片标题的前景色。 接管了 LayoutView.CustomCardStyle 事件来改变相应的外观设置。
结果显示如下:
| C# | 复制代码 |
|---|---|
using DevExpress.XtraGrid.Views.Base; using DevExpress.XtraGrid.Views.Layout.Events; private void layoutView1_CustomCardStyle(object sender, LayoutViewCardStyleEventArgs e) { if ((e.State & GridRowCellState.Focused) != 0) e.Appearance.ForeColor = Color.Blue; else e.Appearance.ForeColor = Color.Brown; } | |
| Visual Basic | 复制代码 |
|---|---|
Imports DevExpress.XtraGrid.Views.Base Imports DevExpress.XtraGrid.Views.Layout.Events Private Sub LayoutView1_CustomCardStyle(ByVal sender As System.Object, _ ByVal e As LayoutViewCardStyleEventArgs) Handles LayoutView1.CustomCardStyle If (e.State And GridRowCellState.Focused) <> 0 Then e.Appearance.ForeColor = Color.Blue Else e.Appearance.ForeColor = Color.Brown End If End Sub | |
