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

속성 값

Boolean

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

예외

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

예제

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

  • 이름이 지정된 filePath 변수가 인쇄할 파일의 경로로 설정되었습니다.

  • 이벤트를 처리하는 PrintPage 명명pd_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 가로 방향을 생성하기 위해 세로 방향이 회전되는 각도를 도 단위로 결정할 수 있습니다.

적용 대상

추가 정보