程序员开发实例大全宝库

网站首页 > 编程文章 正文

WinForm界面控件开发入门指南 - 自定义打印外观

zazugpt 2024-08-20 00:56:32 编程文章 18 ℃ 0 评论

DevExpress WinForm拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!

DevExpress Universal Subscription官方最新版免费下载试用,历史版本下载,在线文档和帮助文件下载-慧都网

如何预览XtraGrid控件

以下示例显示如何预览XtraGrid。

C#

private void ShowGridPreview(DevExpress.XtraGrid.GridControl grid) {
// Check whether the Grid Control can be previewed.
if(!grid.IsPrintingAvailable) {
MessageBox.Show("The 'DevExpress.XtraPrinting' Library is not found", "Error");
return;
}
// Opens the Preview window.
grid.ShowPreview();
}

VB.NET

Sub ShowGridPreview(ByVal grid As DevExpress.XtraGrid.GridControl)
' Check whether the Grid Control can be previewed.
If Not grid.IsPrintingAvailable Then
MessageBox.Show("The 'DevExpress.XtraPrinting' Library is not found", "Error")
Return
End If
' Opens the Preview window.
grid.ShowPreview()
End Sub

下图显示了示例网格的预览窗口。

如何自定义打印外观

以下示例代码演示了如何将打印外观和背景颜色自定义应用于网格控件中的偶数行。

C#

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;

VB.NET

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

结果如下图所示。



本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表