翻譯|使用教程|編輯:龔雪|2021-08-31 11:02:49.807|閱讀 349 次
概述:本文主要介紹如何預覽XtraGrid控件,以及如何自定義打印外觀,歡迎下載最新版體驗!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
獲取工具下載 - DevExpress WinForm v21.1
以下示例顯示如何預覽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
結果如下圖所示。
 
 
DevExpress WinForm擁有180+組件和UI庫,能為Windows Forms平臺創建具有影響力的業務解決方案。DevExpress WinForms能完美構建流暢、美觀且易于使用的應用程序,無論是Office風格的界面,還是分析處理大批量的業務數據,它都能輕松勝任!
更多產品正版授權詳情及優惠,歡迎咨詢
DevExpress技術交流群4:715863792 歡迎一起進群討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自:慧都網