PrintPageEventArgs.HasMorePages 속성

정의

추가 페이지를 인쇄해야 할지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether an additional page should be printed.

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

속성 값

Boolean

추가 페이지를 인쇄해야 하면 true이고 그렇지 않으면 false입니다.true if an additional page should be printed; otherwise, false. 기본값은 false입니다.The default is false.

예제

다음 코드 예제에서는 라는가에 생성 된 것으로 가정 합니다 Button printButton PrintDocument pd Form .The following code example assumes a Button named printButton and a PrintDocument named pd have been created on a Form. Click에 대 한 이벤트가 Button 메서드와 연결 되어 printButton_Click 있고 PrintPage 의 이벤트가 PrintDocument pd_PrintPage 예제의 메서드와 연결 되어 있는지 확인 합니다.Make sure the Click event for the Button is associated with the printButton_Click method and the PrintPage event of the PrintDocument is associated with the pd_PrintPage method in the example. printButton_Click예제의 메서드는 Print 이벤트를 발생 시키는 메서드를 호출 PrintPage 하 고 메서드에 지정 된 .bmp 파일을 인쇄 합니다 pd_PrintPage .The printButton_Click method from the example calls the Print method raising the PrintPage event, and prints the .bmp file specified in the pd_PrintPage method. 이 예를 실행 하려면 인쇄 하려는 비트맵의 경로를 변경 합니다.To run this example, change the path to the bitmap you want to print.

System.Drawing System.Drawing.Printing System.Windows.Forms 이 예제에는, 및 네임 스페이스를 사용 합니다.Use the System.Drawing, System.Drawing.Printing, and System.Windows.Forms namespaces for this example.

private:
   // Specifies what happens when the user clicks the Button.
   void printButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      try
      {
         pd->Print();
      }
      catch ( Exception^ ex ) 
      {
         MessageBox::Show( "An error occurred while printing", ex->ToString() );
      }
   }

   // Specifies what happens when the PrintPage event is raised.
   void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev )
   {
      // Draw a picture.
      ev->Graphics->DrawImage( Image::FromFile( "C:\\My Folder\\MyFile.bmp" ),
         ev->Graphics->VisibleClipBounds );
      
      // Indicate that this is the last page to print.
      ev->HasMorePages = false;
   }

// Specifies what happens when the user clicks the Button.
 private void printButton_Click(object sender, EventArgs e) 
 {
   try 
   {
     // Assumes the default printer.
     pd.Print();
   }  
   catch(Exception ex) 
   {
     MessageBox.Show("An error occurred while printing", ex.ToString());
   }
 }
 
 // Specifies what happens when the PrintPage event is raised.
 private void pd_PrintPage(object sender, PrintPageEventArgs ev) 
 {      
   // Draw a picture.
   ev.Graphics.DrawImage(Image.FromFile("C:\\My Folder\\MyFile.bmp"), ev.Graphics.VisibleClipBounds);
      
   // Indicate that this is the last page to print.
   ev.HasMorePages = false;
 }

' Specifies what happens when the user clicks the Button.
Private Sub printButton_Click(sender As Object, e As EventArgs) _
Handles printButton.Click
    Try
       pd.Print()
    Catch ex As Exception
        MessageBox.Show("An error occurred while printing", _
            ex.ToString())
    End Try
End Sub    

' Specifies what happens when the PrintPage event is raised.
Private Sub pd_PrintPage(sender As Object, ev As PrintPageEventArgs) _
Handles pd.PrintPage

    ' Draw a picture.
    ev.Graphics.DrawImage(Image.FromFile("C:\My Folder\MyFile.bmp"), _
        ev.Graphics.VisibleClipBounds)
    
    ' Indicate that this is the last page to print.
    ev.HasMorePages = False
End Sub

를 사용 하는 방법을 보여 주는 다른 예제를 HasMorePages 보려면 방법: 다중 페이지 텍스트 파일 인쇄 Windows Forms 를 참조 하세요.For another example that shows how to use HasMorePages, see How to: Print a Multi-Page Text File in Windows Forms

적용 대상