PrintForm.PrintAction 屬性

取得或設定值,指出是否將輸出導向印表機、 預覽列印] 視窗中,或檔案。

命名空間:  Microsoft.VisualBasic.PowerPacks.Printing
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(True)> _
Public Property PrintAction As PrintAction
[BrowsableAttribute(true)]
public PrintAction PrintAction { get; set; }
[BrowsableAttribute(true)]
public:
property PrintAction PrintAction {
    PrintAction get ();
    void set (PrintAction value);
}
[<BrowsableAttribute(true)>]
member PrintAction : PrintAction with get, set
function get PrintAction () : PrintAction
function set PrintAction (value : PrintAction)

屬性值

型別:System.Drawing.Printing.PrintAction
傳回PrintAction列舉型別。

備註

當PrintToPrinter已選取,將輸出導向至系統預設的印表機。您可以覆寫這個行為,並明確地使用,以設定印表機和印表機內容PrinterSettings屬性。如果使用預設的印表機,則會提示使用者選取印表機。

當PrintToPreview已選取,表單會顯示在標準的 Windows Form PrintPreviewDialog控制項。

當PrintToFile已選取,表單的影像會儲存封裝的 PostScript 檔案 (.eps、.ps 或.ai) 中所指定的路徑PrintFileName屬性。如果沒有指定檔案名稱時,會提示使用者,輸入檔案名稱。

注意事項注意事項

檔案會儲存在 8 位元灰階 PostScript 格式。不支援 24 位元 RGB PostScript。

注意事項注意事項

路徑或檔案名稱副檔名,不提示使用者。若要確定此檔案包含有效的路徑和副檔名,您可以實作自己的對話方塊。若要執行這項操作,請使用SaveFileDialog元件並指派傳回值為PrintFileName屬性之前呼叫Print方法。

範例

下列範例示範如何設定 PrintAction 屬性。這個範例要求您必須PrintForm名為 PrintForm1 和第三個元件RadioButton在表單上的控制項。

If RadioButton1.Checked = True Then
    PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
ElseIf RadioButton2.Checked = True Then
    PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
Else
    PrintForm1.PrintFileName = _
  My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData _
  & "Form1.eps"
    PrintForm1.PrintAction = Printing.PrintAction.PrintToFile
End If

.NET Framework 安全性

請參閱

參考

PrintForm 類別

Microsoft.VisualBasic.PowerPacks.Printing 命名空間

其他資源

PrintForm 元件 (Visual Basic)

HOW TO:使用 PrintForm 元件列印表單 (Visual Basic)

HOW TO:列印表單的工作區 (Visual Basic)

HOW TO:列印表單的工作區和非工作區 (Visual Basic)

HOW TO:列印可捲動的表單 (Visual Basic)

部署參考 PrintForm 元件的應用程式 (Visual Basic)