Control.CreateParams 속성

정의

컨트롤 핸들이 만들어지는 경우 필요한 작성 매개 변수를 가져옵니다.

protected:
 virtual property System::Windows::Forms::CreateParams ^ CreateParams { System::Windows::Forms::CreateParams ^ get(); };
protected virtual System.Windows.Forms.CreateParams CreateParams { get; }
member this.CreateParams : System.Windows.Forms.CreateParams
Protected Overridable ReadOnly Property CreateParams As CreateParams

속성 값

CreateParams

컨트롤 핸들을 만들 때 필요한 작성 매개 변수가 포함된 CreateParams입니다.

예제

다음 코드 예제에서는 파생 클래스의 Button 속성을 확장 CreateParams 합니다. CreateParams.Style 속성이 변경되어 단추가 대신 표시됩니다 Icon Image. 이 예제에서는 클래스에서 상속되는 클래스가 Button 있어야 합니다.

virtual System::Windows::Forms::CreateParams^ get() override
{
   
   // Extend the CreateParams property of the Button class.
   System::Windows::Forms::CreateParams^ cp = __super::CreateParams;

   // Update the button Style.
   cp->Style |= 0x00000040; // BS_ICON value
   return cp;
}
protected override CreateParams CreateParams
{
    get
    {
        // Extend the CreateParams property of the Button class.
        CreateParams cp = base.CreateParams;
        // Update the button Style.
        cp.Style |= 0x00000040; // BS_ICON value

        return cp;
    }
}

Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
    Get
        Dim SecPerm As New SecurityPermission(SecurityPermissionFlag.UnmanagedCode)
        SecPerm.Demand()

        ' Extend the CreateParams property of the Button class.
        Dim cp As System.Windows.Forms.CreateParams = MyBase.CreateParams
        ' Update the button Style.
        cp.Style = cp.Style Or &H40 ' BS_ICON value

        Return cp
    End Get
End Property

설명

속성을 CreateParams 재정의하고 파생된 컨트롤의 속성을 조정하는 데 사용하면 안 됩니다. Properties such as the CreateParams.Caption, CreateParams.Width, and CreateParams.Height should be set by the corresponding properties in your control such as Control.Text, Control.Width and Control.Height. CreateParams 표준 Windows 컨트롤 클래스를 래핑하거나 Windows Forms 네임스페이스에서 제공하지 않는 스타일을 설정하는 경우에만 확장해야 합니다. 컨트롤 매개 변수를 만드는 방법에 대한 자세한 내용은 CREATESTRUCT 구조 설명서 및 CreateWindowEx 함수를 참조 CreateWindow 하세요.

상속자 참고

파생 클래스의 CreateParams 속성을 재정의할 때 기본 클래스의 CreateParams 속성을 사용하여 기본 구현을 확장합니다. 그렇지 않으면 모든 구현을 제공해야 합니다.

적용 대상

추가 정보