PageSettings.Landscape プロパティ
アセンブリ: System.Drawing (system.drawing.dll 内)
構文Dim instance As PageSettings Dim value As Boolean value = instance.Landscape instance.Landscape = value
/** @property */ public boolean get_Landscape () /** @property */ public void set_Landscape (boolean value)
ページを横向きで印刷する場合は true。それ以外の場合は false。既定値はプリンタによって決定されます。
例外
解説
使用例PrintDocument.DefaultPageSettings プロパティを使用して文書の既定の用紙方向を横向きに設定し、文書を印刷するコード例を次に示します。この例には、次の 3 つの必要条件があります。
この例では、System.Drawing、System.Drawing.Printing、および System.IO の各名前空間を使用します。
Public Sub Printing() Try streamToPrint = New StreamReader(filePath) Try printFont = New Font("Arial", 10) Dim pd As New PrintDocument() AddHandler pd.PrintPage, AddressOf pd_PrintPage pd.PrinterSettings.PrinterName = printer ' Set the page orientation to landscape. pd.DefaultPageSettings.Landscape = True pd.Print() Finally streamToPrint.Close() End Try Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
public void Printing() { try { streamToPrint = new StreamReader (filePath); try { printFont = new Font("Arial", 10); PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(pd_PrintPage); pd.PrinterSettings.PrinterName = printer; // Set the page orientation to landscape. pd.DefaultPageSettings.Landscape = true; pd.Print(); } finally { streamToPrint.Close() ; } } catch(Exception ex) { MessageBox.Show(ex.Message); } }
public: void Printing() { try { streamToPrint = gcnew StreamReader( filePath ); try { printFont = gcnew Font( "Arial",10 ); PrintDocument^ pd = gcnew PrintDocument; pd->PrintPage += gcnew PrintPageEventHandler( this, &Sample::pd_PrintPage ); pd->PrinterSettings->PrinterName = printer; // Set the page orientation to landscape. pd->DefaultPageSettings->Landscape = true; pd->Print(); } finally { streamToPrint->Close(); } } catch ( Exception^ ex ) { MessageBox::Show( ex->Message ); } }
public void Printing() { try { streamToPrint = new StreamReader(filePath); try { printFont = new Font("Arial", 10); PrintDocument pd = new PrintDocument(); pd.add_PrintPage(new PrintPageEventHandler(pd_PrintPage)); pd.get_PrinterSettings().set_PrinterName(printer); // Set the page orientation to landscape. pd.get_DefaultPageSettings().set_Landscape(true); pd.Print(); } finally { streamToPrint.Close(); } } catch (System.Exception ex) { MessageBox.Show(ex.get_Message()); } } //Printing
プラットフォームWindows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照PageSettings クラス
PageSettings メンバ
System.Drawing.Printing 名前空間
PrintDocument
PrintDocument.PrintPage
PrinterSettings.LandscapeAngle
- PageSettings.Landscape プロパティのページへのリンク