PageSettings.Landscape 속성

정의

페이지를 가로 또는 세로 방향으로 인쇄할지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool Landscape { bool get(); void set(bool value); };
public bool Landscape { get; set; }
member this.Landscape : bool with get, set
Public Property Landscape As Boolean

속성 값

페이지를 가로 방향으로 인쇄해야 하면 true이고 그렇지 않으면 false입니다. 기본값은 프린터에 따라 다릅니다.

예외

PrinterName 속성에 명명된 프린터가 없는 경우

예제

다음은 문서의 기본 페이지 방향을 속성을 가로 PrintDocument.DefaultPageSettings 로 설정하고 문서를 인쇄하는 코드 예제입니다. 이 예제에는 다음 세 가지 필수 구성 요소가 있습니다.

  • 라는 filePath 변수가 인쇄할 파일의 경로로 설정되었습니다.

  • 이벤트를 처리하는 라는 pd_PrintPage메서드가 PrintPage 정의되었습니다.

  • 라는 printer 변수가 프린터 이름으로 설정되었습니다.

이 예제에서는 System.Drawing, System.Drawing.PrintingSystem.IO 네임스페이스를 사용합니다.

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.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 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

설명

사용할 수 있습니다는 PrinterSettings.LandscapeAngle 각도를 확인 하는 속성, 도, 가로 방향을 생성 하기 위해 세로 방향 회전 됩니다.

적용 대상

추가 정보