1 / 10

列印功能

列印功能. Windows 程式設計基本概念. .NET Framework 2.0 中的列印控制項. 用來在 Windows 架構應用程式中設定列印的頁面詳細資料。. 用來選取印表機、選擇列印頁面以及決定其他與列印相關的設定。. PrintPreviewControl 是用來顯示在列印 PrintDocument 時會出現的外觀。. PrintDocument 實際負責列印功能,可用來設定列印內容及列印文件能力的屬性。它可以與 PrintDialog 元件一起用於控制與文件列印相關的所有事項。.

effie
Télécharger la présentation

列印功能

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 列印功能

  2. Windows程式設計基本概念 .NET Framework 2.0中的列印控制項 用來在 Windows 架構應用程式中設定列印的頁面詳細資料。 用來選取印表機、選擇列印頁面以及決定其他與列印相關的設定。 PrintPreviewControl 是用來顯示在列印 PrintDocument 時會出現的外觀。 PrintDocument 實際負責列印功能,可用來設定列印內容及列印文件能力的屬性。它可以與 PrintDialog 元件一起用於控制與文件列印相關的所有事項。 PrintPreviewDialog 控制項是預先設定的對話方塊,用來顯示文件列印後的樣子。

  3. Windows程式設計基本概念 PageSetupDialog 基本功能:設定列印紙張格式。 使用時機:需要調整列印紙張的規格。 外觀:當PageSetupDialog被拖曳出來後,會出現在component tray。 PageSetupDialog可用來調整列印時紙張邊界的設定、紙張直印或橫印…等功能。

  4. Windows程式設計基本概念 PageSetupDialog 當我們使用PrintDocument這個控制項(物件)作為PageSetupDialog初始化的參數時,PrintDocument元件對於頁面的參數設定會隨著PageSetupDialog的設定而更動,所以我們無須另外撰寫程式碼設定更改後的數據: 我們可以發現,在Visual Basic 2005中的列印動作,是透過『PrintDocument』來進行,而我們則可以透過『PageSetupDialog』控制項,來設定『PrintDocument』的列印參數與狀態。

  5. Windows程式設計基本概念 PrintDialog 基本功能:列印的對話視窗。 使用時機:在列印之前,設定列印幾份、列印範圍等。 外觀:當PrintDialog被拖曳出來後,會出現在component tray。

  6. Windows程式設計基本概念 PrintDialog PrintDialog是列印對話視窗,與一般我們按下印表機後出現的對話視窗相同,可以調整列印範圍、選擇印表機…等。 使用PrintDialog1.ShowDialog()之前,我們一樣要先將PrintDocument指定給PrintDialog,作為PrintDialog的初始化版面設定: 『PrintDialog1』設定要列印文件為『PrintDocument1』 呼叫PrintDocument1的『Print方法』實際把文件列印出來。

  7. Windows程式設計基本概念 PrintDocument 基本功能:描述列印版面設置的物件。 使用時機:PrintDocument會動態的跟著PageSetupDialog的設定更改屬性值,也可以直接指定給PrintPreviewControl或PrintDialog,當作列印版面初始化的依據。您可以透過PrintDocument控制項來實際列印一份文件。 請注意,列印動作可透過『PrintDocument1.Print()』方法來完成,而要列印的內容,則是透過『PrintDocument1_PrintPage』事件當中的參數『e』來指定,並且以繪製的方式輸出到印表機上。

  8. Windows程式設計基本概念 PrintDocument 請注意,列印動作可透過『PrintDocument1.Print()』方法來完成,而要列印的內容,則是透過『PrintDocument1_PrintPage』事件當中的參數『e』來指定,並且以繪製的方式輸出到印表機上。

  9. Windows程式設計基本概念 PrintPreviewDialog 基本功能:預覽列印的對話視窗。 使用時機:提供使用者預覽的功能,查看文件列印後的狀況,排版適不適合。 外觀:當PrintPreviewDialog被拖曳出來後,會出現在component tray。

  10. Windows程式設計基本概念 PrintPreviewDialog 0091: '預覽列印ToolStripButton_Click 0092: Private Sub 預覽列印ToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 預覽列印ToolStripButton.Click 0093: '設定doc,取得要列印的文字 0094: doc = Me.TextBox1.Text 0095: '給定要預覽的文件格式 0096: Me.PrintPreviewDialog1.Document = Me.PrintDocument1 0097: '開啟預覽列印對話視窗 0098: Me.PrintPreviewDialog1.ShowDialog() 0099: End Sub

More Related