下面的示例代码展示了如何激活打印外观,并为控件中的 XtraGrid 偶数行定制背景色:

C#CopyCode image复制代码
gridView1.OptionsPrint.UsePrintStyles = true;
// Enable the AppearancePrint.EvenRow property's settings.
gridView1.OptionsPrint.EnableAppearanceEvenRow = true;
// Set the background color of the even rows.
gridView1.AppearancePrint.EvenRow.BackColor = Color.LightYellow;

Visual BasicCopyCode image复制代码
GridView1.OptionsPrint.UsePrintStyles = True
' Enable the AppearancePrint.EvenRow property's settings.
GridView1.OptionsPrint.EnableAppearanceEvenRow = True
' Set the background color of the even rows.
GridView1.AppearancePrint.EvenRow.BackColor = Color.LightYellow

结果如下图所示。