Gets the required creation parameters when the control handle is created.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The property should not be overridden and used to adjust the properties of your derived control. 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. The CreateParams should only be extended when you are wrapping a standard Windows control class or to set styles not provided by the Windows Forms namespace. For more information about creating control parameters, see the CreateWindow and CreateWindowEx functions and the CREATESTRUCT structure documentation in the MSDN library at http://msdn.microsoft.com/library.Notes to Inheritors
When overriding the property in a derived class, use the base class's property to extend the base implementation. Otherwise, you must provide all the implementation.
The following code example extends the property of a Button derived class. The CreateParams.Style property is changed, which causes the button to display an Icon rather than an Image. This example requires that you have a class that inherits from the Button class.
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
for inheriting classes to call unmanaged code when getting the property value. Associated enumeration: SecurityPermissionFlag.UnmanagedCode
for the immediate caller to call unmanaged code when getting the property value. Associated enumeration: SecurityPermissionFlag.UnmanagedCode
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.