VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
PrintDialogの[ページ範囲]欄には、「すべて」「選択した部分」「現在のページ」「ページ指定」の項目がありますが、デフォルトでは「すべて」以外は無効状態となっており選択することができません。
下記プロパティをTrueにすることで有効にすることができます。
項目 | プロパティ |
---|---|
選択した部分 | AllowSelection |
現在のページ | AllowCurrentPage |
ページ指定 | AllowSomePages |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ps As New Printing.PrinterSettings 'プリンタ設定情報をダイアログにセット PrintDialog1.PrinterSettings = ps '選択した部分 PrintDialog1.AllowSelection = True '現在のページ PrintDialog1.AllowCurrentPage = True 'ページ指定 PrintDialog1.AllowSomePages = True 'PrintDialog表示する If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then End If End Sub