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