WebBrowser.ShowPrintDialog 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在未設定頁首和頁尾值的情況下,開啟Internet Explorer Print對話框。
public:
void ShowPrintDialog();
public void ShowPrintDialog();
member this.ShowPrintDialog : unit -> unit
Public Sub ShowPrintDialog ()
範例
以下程式碼範例示範如何使用 ShowPrintDialog 方法實作一個與 Internet Explorer File選單中的 Print 選單選項。 這個例子要求你的表單包含一個選單,裡面有一個叫做選單項目的選單項目和MenuItemFilePrint一個叫WebBrowser做的控制項webBrowser1.
// Displays the Print dialog box.
void MenuItemFilePrint_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
this->WebBrowser1->ShowPrintDialog();
}
// Displays the Print dialog box.
private void printToolStripMenuItem_Click(object sender, EventArgs e)
{
webBrowser1.ShowPrintDialog();
}
' Displays the Print dialog box.
Private Sub printToolStripMenuItem_Click( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles printToolStripMenuItem.Click
webBrowser1.ShowPrintDialog()
End Sub
備註
你可以用這個方法實作一個 Print 選單項目,類似於 Internet Explorer File 選單中的項目。 此方法會顯示 列印 對話框,讓使用者在列印前能調整列印設定。 要讓使用者在列印前自行指定頁面設定,請使用此 ShowPageSetupDialog 方法。 要顯示 列印預覽 對話框,請使用以下 ShowPrintPreviewDialog 方法。