CheckBox.CreateParams 属性   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取创建控件句柄时所需要的创建参数。
protected:
 virtual property System::Windows::Forms::CreateParams ^ CreateParams { System::Windows::Forms::CreateParams ^ get(); };protected override System.Windows.Forms.CreateParams CreateParams { get; }member this.CreateParams : System.Windows.Forms.CreateParamsProtected Overrides ReadOnly Property CreateParams As CreateParams属性值
CreateParams,包含创建控件的句柄时所需的创建参数。
示例
下面的代码示例扩展 CreateParams 派生类的属性 Button 。 属性 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