CreateParams Eigenschaft
TOC
Inhaltsverzeichnis reduzieren
Inhaltsverzeichnis erweitern
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
Übersetzung
Original

Control.CreateParams-Eigenschaft

 

Ruft die benötigten Erstellungsparameter ab, wenn das Steuerelementhandle erstellt wird.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

protected virtual CreateParams CreateParams {
	[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, 
		Flags = SecurityPermissionFlag.UnmanagedCode)]
	[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
	get;
}

Eigenschaftswert

Type: System.Windows.Forms.CreateParams

Eine CreateParams-Eigenschaft, die die erforderlichen Erstellungsparameter enthält, wenn das Handle für das Steuerelement erstellt wird.

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.

Hinweise zur Vererbung:

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.

protected override CreateParams CreateParams
{
    get
    {
        new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();

        // Extend the CreateParams property of the Button class.
        CreateParams cp = base.CreateParams;
        // Update the button Style.
        cp.Style |= 0x00000040; // BS_ICON value

        return cp;
    }
}

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

.NET Framework
Verfügbar seit 1.1
Zurück zum Anfang
Anzeigen:
© 2016 Microsoft