다음을 통해 공유


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 컨트롤에 대한 핸들을 만들 때 필요한 생성 매개 변수를 포함하는 A입니다.

예제

다음 코드 예제에서는 CreateParams 파생 클래스의 Button 속성을 확장합니다. CreateParams.Style 속성이 변경되어 단추가 대신 Image표시됩니다Icon. 이 예제에서는 클래스에서 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 재정의하여 파생된 컨트롤의 속성을 조정하는 데 사용하면 안 됩니다. 와 같은 속성은 CreateParams.Height 컨트롤의 CreateParams.CaptionCreateParams.Width해당 속성(예: Control.TextControl.WidthControl.Height)에 의해 설정되어야 합니다. CreateParams 표준 Windows 컨트롤 클래스를 래핑하거나 Windows Forms 네임스페이스에서 제공하지 않는 스타일을 설정하는 경우에만 확장해야 합니다. 컨트롤 매개 변수를 만드는 방법에 대한 자세한 내용은 및 함수 및 CreateWindowExCREATESTRUCT 구조 설명서를 참조 CreateWindow 하세요.

상속자 참고

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

적용 대상

추가 정보