CommonDialog 클래스

정의

화면에 대화 상자를 표시하는 데 사용되는 기본 클래스를 지정합니다.

public ref class CommonDialog abstract : System::ComponentModel::Component
public abstract class CommonDialog : System.ComponentModel.Component
type CommonDialog = class
    inherit Component
Public MustInherit Class CommonDialog
Inherits Component
상속
파생

예제

다음 코드 예제에서는 구현 CommonDialogColorDialog 사용하며 대화 상자를 만들고 표시하는 방법을 보여 줍니다. 이 예제에서는 메서드를 기존 폼 내에서 호출해야 합니다. 이 양식에는 TextBox 메서드가 있고 Button 해당 폼에 배치되어 있어야 합니다.

private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      ColorDialog^ MyDialog = gcnew ColorDialog;
      // Keeps the user from selecting a custom color.
      MyDialog->AllowFullOpen = false;
      // Allows the user to get help. (The default is false.)
      MyDialog->ShowHelp = true;
      // Sets the initial color select to the current text color.
      MyDialog->Color = textBox1->ForeColor;
      
      // Update the text box color if the user clicks OK 
      if ( MyDialog->ShowDialog() == ::System::Windows::Forms::DialogResult::OK )
      {
         textBox1->ForeColor = MyDialog->Color;
      }
   }
private void button1_Click(object sender, System.EventArgs e)
 {
    ColorDialog MyDialog = new ColorDialog();
    // Keeps the user from selecting a custom color.
    MyDialog.AllowFullOpen = false ;
    // Allows the user to get help. (The default is false.)
    MyDialog.ShowHelp = true ;
    // Sets the initial color select to the current text color.
    MyDialog.Color = textBox1.ForeColor ;
    
    // Update the text box color if the user clicks OK 
    if (MyDialog.ShowDialog() == DialogResult.OK)
        textBox1.ForeColor =  MyDialog.Color;
 }
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim MyDialog As New ColorDialog()
    ' Keeps the user from selecting a custom color.
    MyDialog.AllowFullOpen = False
    ' Allows the user to get help. (The default is false.)
    MyDialog.ShowHelp = True
    ' Sets the initial color select to the current text color,
    MyDialog.Color = TextBox1.ForeColor

    ' Update the text box color if the user clicks OK 
    If (MyDialog.ShowDialog() = DialogResult.OK) Then
        TextBox1.ForeColor = MyDialog.Color
    End If
End Sub

설명

상속된 클래스는 특정 공통 대화 상자를 만들기 위해 호출하여 ShowDialog 구현 RunDialog 해야 합니다. 상속된 클래스는 필요에 따라 재정 HookProc 의하여 특정 대화 상자 후크 기능을 구현할 수 있습니다.

생성자

Name Description
CommonDialog()

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

속성

Name Description
CanRaiseEvents

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

(다음에서 상속됨 Component)
Container

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

(다음에서 상속됨 Component)
DesignMode

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

(다음에서 상속됨 Component)
Events

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

(다음에서 상속됨 Component)
Site

ISite를 가져오거나 Component의 값을 설정합니다.

(다음에서 상속됨 Component)
Tag

컨트롤에 대한 데이터가 포함된 개체를 가져오거나 설정합니다.

메서드

Name Description
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)

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

InitializeLifetimeService()

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

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

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

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

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

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

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

OwnerWndProc(IntPtr, Int32, IntPtr, IntPtr)

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

Reset()

파생 클래스에서 재정의된 경우 공통 대화 상자의 속성을 기본값으로 다시 설정합니다.

RunDialog(IntPtr)

파생 클래스에서 재정의되는 경우 공통 대화 상자를 지정합니다.

ShowDialog()

기본 소유자와 함께 공통 대화 상자를 실행합니다.

ShowDialog(IWin32Window)

지정된 소유자와 함께 공통 대화 상자를 실행합니다.

ToString()

String(있는 경우)의 Component이름을 포함하는 값을 반환합니다. 이 메서드는 재정의해서는 안 됩니다.

(다음에서 상속됨 Component)

이벤트

Name Description
Disposed

구성 요소가 메서드 호출에 Dispose() 의해 삭제될 때 발생합니다.

(다음에서 상속됨 Component)
HelpRequest

사용자가 일반적인 대화 상자에서 도움말 단추를 클릭할 때 발생합니다.

적용 대상