Export (0) Print
Expand All
Expand Minimize

Control.CreateParams Property

Gets the required creation parameters when the control handle is created.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

protected:
virtual property CreateParams^ CreateParams {
	CreateParams^ get ();
}
/** @property */
protected CreateParams get_CreateParams ()

protected function get CreateParams () : CreateParams

Property Value

A CreateParams that contains the required creation parameters when the handle to the control is created.

The CreateParams 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 Windows Platform SDK reference located in the MSDN library at http://msdn.microsoft.com/library.

Notes to Inheritors When overriding the CreateParams property in a derived class, use the base class's CreateParams property to extend the base implementation. Otherwise, you must provide all the implementation.

The following code example extends the CreateParams 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.

/** @property 
 */
protected CreateParams get_CreateParams()
{
    // Extend the CreateParams property of the Button class.
    CreateParams cp = super.get_CreateParams();

    // Update the button Style.
    cp.set_Style(cp.get_Style() | 0x40); // BS_ICON value
    return cp;
} //get_CreateParams

  • SecurityPermission  for inheriting classes to call unmanaged code when getting the property value. Associated enumeration: SecurityPermissionFlag.UnmanagedCode
  • SecurityPermission  for the immediate caller to call unmanaged code when getting the property value. Associated enumeration: SecurityPermissionFlag.UnmanagedCode

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft