PageSetupDialog 클래스

정의

사용자가 여백 및 페이지 방향을 비롯하여 페이지 관련 인쇄 설정을 변경할 수 있도록 합니다. 이 클래스는 상속될 수 없습니다.

public ref class PageSetupDialog sealed : System::Windows::Forms::CommonDialog
public sealed class PageSetupDialog : System.Windows.Forms.CommonDialog
type PageSetupDialog = class
    inherit CommonDialog
Public NotInheritable Class PageSetupDialog
Inherits CommonDialog
상속

예제

다음 코드 예제를 사용 하 여 보여 줍니다 PageSetupDialogPageSettings, PrinterSettingsShowNetwork 속성입니다. 이 예제를 실행하려면 라는 , ListBox1ListBox 명명된 Button 및 라는 Button1가 포함된 폼에 PageSetupDialogPageSetupDialog1배치합니다. 이 예제에서는 단추의 클릭 이벤트가 이벤트 처리 메서드에 연결되어 있는지 확인합니다.

//This method displays a PageSetupDialog object. If the
// user clicks OK in the dialog, selected results of
// the dialog are displayed in ListBox1.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   
   // Initialize the dialog's PrinterSettings property to hold user
   // defined printer settings.
   PageSetupDialog1->PageSettings = gcnew System::Drawing::Printing::PageSettings;
   
   // Initialize dialog's PrinterSettings property to hold user
   // set printer settings.
   PageSetupDialog1->PrinterSettings = gcnew System::Drawing::Printing::PrinterSettings;
   
   //Do not show the network in the printer dialog.
   PageSetupDialog1->ShowNetwork = false;
   
   //Show the dialog storing the result.
   System::Windows::Forms::DialogResult result = PageSetupDialog1->ShowDialog();
   
   // If the result is OK, display selected settings in
   // ListBox1. These values can be used when printing the
   // document.
   if ( result == ::DialogResult::OK )
   {
      array<Object^>^results = {PageSetupDialog1->PageSettings->Margins,PageSetupDialog1->PageSettings->PaperSize,PageSetupDialog1->PageSettings->Landscape,PageSetupDialog1->PrinterSettings->PrinterName,PageSetupDialog1->PrinterSettings->PrintRange};
      ListBox1->Items->AddRange( results );
   }
   
}

//This method displays a PageSetupDialog object. If the
// user clicks OK in the dialog, selected results of
// the dialog are displayed in ListBox1.
private void Button1_Click(System.Object sender, System.EventArgs e)
{

    // Initialize the dialog's PrinterSettings property to hold user
    // defined printer settings.
    PageSetupDialog1.PageSettings =
        new System.Drawing.Printing.PageSettings();

    // Initialize dialog's PrinterSettings property to hold user
    // set printer settings.
    PageSetupDialog1.PrinterSettings =
        new System.Drawing.Printing.PrinterSettings();

    //Do not show the network in the printer dialog.
    PageSetupDialog1.ShowNetwork = false;

    //Show the dialog storing the result.
    DialogResult result = PageSetupDialog1.ShowDialog();

    // If the result is OK, display selected settings in
    // ListBox1. These values can be used when printing the
    // document.
    if (result == DialogResult.OK)
    {
        object[] results = new object[]{ 
            PageSetupDialog1.PageSettings.Margins, 
            PageSetupDialog1.PageSettings.PaperSize, 
            PageSetupDialog1.PageSettings.Landscape, 
            PageSetupDialog1.PrinterSettings.PrinterName, 
            PageSetupDialog1.PrinterSettings.PrintRange};
        ListBox1.Items.AddRange(results);
    }
}

'This method displays a PageSetupDialog object. If the
' user clicks OK in the dialog, selected results of
' the dialog are displayed in ListBox1.
Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click

    ' Initialize the dialog's PrinterSettings property to hold user
    ' defined printer settings.
    PageSetupDialog1.PageSettings = _
        New System.Drawing.Printing.PageSettings

    ' Initialize dialog's PrinterSettings property to hold user
    ' set printer settings.
    PageSetupDialog1.PrinterSettings = _
        New System.Drawing.Printing.PrinterSettings

    'Do not show the network in the printer dialog.
    PageSetupDialog1.ShowNetwork = False

    'Show the dialog storing the result.
    Dim result As DialogResult = PageSetupDialog1.ShowDialog()

    ' If the result is OK, display selected settings in
    ' ListBox1. These values can be used when printing the
    ' document.
    If (result = DialogResult.OK) Then
        Dim results() As Object = New Object() _
            {PageSetupDialog1.PageSettings.Margins, _
             PageSetupDialog1.PageSettings.PaperSize, _
             PageSetupDialog1.PageSettings.Landscape, _
             PageSetupDialog1.PrinterSettings.PrinterName, _
             PageSetupDialog1.PrinterSettings.PrintRange}
        ListBox1.Items.AddRange(results)
    End If

End Sub

설명

대화 상자는 PageSetupDialog 지정된 DocumentPageSettings 대한 및 PrinterSettings 정보를 수정합니다. 사용자는 대화 상자의 섹션을 사용하여 인쇄 및 여백을 조작할 수 있습니다. 용지 방향, 크기 및 원본; 및 를 선택하여 도움말 및 네트워크 단추를 표시합니다. 속성은 MinMargins 사용자가 선택할 수 있는 최소 여백을 정의합니다.

클래스의 PageSetupDialog instance 만들면 읽기/쓰기 속성이 초기 값으로 설정됩니다. 이러한 값의 목록을 보려면 참조는 PageSetupDialog 생성자입니다.

PageSetupDialog 를 표시하려면 페이지 설정이 필요하므로 를 호출ShowDialog하기 전에 , PrinterSettings또는 PageSettings 속성을 설정Document해야 합니다. 그렇지 않으면 예외가 발생합니다.

생성자

PageSetupDialog()

PageSetupDialog 클래스의 새 인스턴스를 초기화합니다.

속성

AllowMargins

대화 상자의 여백 섹션이 활성화되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

AllowOrientation

대화 상자의 방향 섹션(가로 대 세로)을 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

AllowPaper

대화 상자의 용지 섹션(용지 크기 및 용지 공급)이 활성화되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

AllowPrinter

프린터 단추를 사용할 수 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

CanRaiseEvents

구성 요소가 이벤트를 발생시킬 수 있는지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
Container

IContainer을 포함하는 Component를 가져옵니다.

(다음에서 상속됨 Component)
DesignMode

Component가 현재 디자인 모드인지 여부를 나타내는 값을 가져옵니다.

(다음에서 상속됨 Component)
Document

페이지 설정을 가져올 PrintDocument를 나타내는 값을 가져오거나 설정합니다.

EnableMetric

밀리미터 단위로 표시될 때 여백 설정을 100인치 단위로/로부터 자동으로 변환할지 여부를 나타내는 값을 가져오거나 설정합니다.

Events

Component에 연결된 이벤트 처리기의 목록을 가져옵니다.

(다음에서 상속됨 Component)
MinMargins

선택할 수 있는 최소 여백(1/100인치)을 나타내는 값을 가져오거나 설정합니다.

PageSettings

수정할 페이지 설정을 나타내는 값을 가져오거나 설정합니다.

PrinterSettings

대화 상자에서 프린터 단추를 클릭하는 경우 수정되는 프린터 설정을 가져오거나 설정합니다.

ShowHelp

도움말 단추가 표시되는지 여부를 나타내는 값을 가져오거나 설정합니다.

ShowNetwork

네트워크 단추가 표시되는지 여부를 나타내는 값을 가져오거나 설정합니다.

Site

ComponentISite를 가져오거나 설정합니다.

(다음에서 상속됨 Component)
Tag

컨트롤에 대한 데이터가 들어 있는 개체를 가져오거나 설정합니다.

(다음에서 상속됨 CommonDialog)

메서드

CreateObjRef(Type)

원격 개체와 통신하는 데 사용되는 프록시 생성에 필요한 모든 관련 정보가 들어 있는 개체를 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
Dispose()

Component에서 사용하는 모든 리소스를 해제합니다.

(다음에서 상속됨 Component)
Dispose(Boolean)

Component에서 사용하는 관리되지 않는 리소스를 해제하고, 관리되는 리소스를 선택적으로 해제할 수 있습니다.

(다음에서 상속됨 Component)
Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 현재의 수명 서비스 개체를 검색합니다.

(다음에서 상속됨 MarshalByRefObject)
GetService(Type)

Component 또는 해당 Container에서 제공하는 서비스를 나타내는 개체를 반환합니다.

(다음에서 상속됨 Component)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
HookProc(IntPtr, Int32, IntPtr, IntPtr)

일반 대화 상자에 특정 기능을 추가하도록 재정의된 일반 대화 상자의 후크 프로시저를 정의합니다.

(다음에서 상속됨 CommonDialog)
InitializeLifetimeService()
사용되지 않음.

이 인스턴스의 수명 정책을 제어하는 수명 서비스 개체를 가져옵니다.

(다음에서 상속됨 MarshalByRefObject)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
MemberwiseClone(Boolean)

현재 MarshalByRefObject 개체의 단순 복사본을 만듭니다.

(다음에서 상속됨 MarshalByRefObject)
OnHelpRequest(EventArgs)

HelpRequest 이벤트를 발생시킵니다.

(다음에서 상속됨 CommonDialog)
OwnerWndProc(IntPtr, Int32, IntPtr, IntPtr)

일반 대화 상자에 특정 기능을 추가하도록 재정의된 소유자 창 프로시저를 정의합니다.

(다음에서 상속됨 CommonDialog)
Reset()

모든 옵션을 기본값으로 다시 설정합니다.

RunDialog(IntPtr)

파생 클래스에서 재정의된 경우 일반 대화 상자를 지정합니다.

(다음에서 상속됨 CommonDialog)
ShowDialog()

기본 소유자로 일반 대화 상자를 실행합니다.

(다음에서 상속됨 CommonDialog)
ShowDialog(IWin32Window)

지정된 소유자로 일반 대화 상자를 실행합니다.

(다음에서 상속됨 CommonDialog)
ToString()

Component의 이름이 포함된 String을 반환합니다(있는 경우). 이 메서드는 재정의할 수 없습니다.

(다음에서 상속됨 Component)

이벤트

Disposed

Dispose() 메서드를 호출하여 구성 요소를 삭제할 때 발생합니다.

(다음에서 상속됨 Component)
HelpRequest

일반 대화 상자의 도움말 단추를 클릭하면 발생합니다.

(다음에서 상속됨 CommonDialog)

적용 대상

추가 정보