PageSettings.Landscape 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
페이지를 가로 또는 세로 방향으로 인쇄할지 여부를 나타내는 값을 가져오거나 설정합니다.
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.Printing및 System.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 각도를 확인 하는 속성, 도, 가로 방향을 생성 하기 위해 세로 방향 회전 됩니다.
적용 대상
추가 정보
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기