AABBbaby

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

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

获取工具下载 - DevExpress WinForm v21.1

DevExpress技术交流群4:715863792      欢迎一起进群讨论

如何预览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

 

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

DevExpress WinForm控件入门指南 - 预览XtraGrid控件
如何自定义打印外观

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

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

 

结果如下图所示。

DevExpress WinForm控件入门指南 - 自定义打印外观

DevExpress WinForm | 下载试用

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


更多DevExpress线上公开课、中文教程资讯请上中文网获取

posted on   AABBbaby  阅读(117)  评论(0编辑  收藏  举报

编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2020-09-01 界面开发包DevExpress v20.1.7上线!即刻体验
2020-09-01 WPF界面开发2020:Scheduler等控件功能升级
点击右上角即可分享
微信分享提示