Cet article a fait l’objet d’une traduction automatique. Pour afficher l’article en anglais, activez la case d’option Anglais. Vous pouvez également afficher le texte anglais dans une fenêtre contextuelle en faisant glisser le pointeur de la souris sur le texte traduit.
Traduction
Anglais

Control.CreateParams propriété

 

Date de publication : novembre 2016

Obtient le paramètre de création requis lors de la création du handle du contrôle.

Espace de noms:   System.Windows.Forms
Assembly:  System.Windows.Forms (dans System.Windows.Forms.dll)

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

Valeur de propriété

Type: System.Windows.Forms.CreateParams

CreateParams qui contient les paramètres de création requis quand le handle du contrôle est créé.

The P:System.Windows.Forms.Control.CreateParams property should not be overridden and used to adjust the properties of your derived control. Properties such as the P:System.Windows.Forms.CreateParams.Caption, P:System.Windows.Forms.CreateParams.Width, and P:System.Windows.Forms.CreateParams.Height should be set by the corresponding properties in your control such as P:System.Windows.Forms.Control.Text, P:System.Windows.Forms.Control.Width and P:System.Windows.Forms.Control.Height. The T:System.Windows.Forms.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 CREATESTRUCThttp://msdn.microsoft.com/library/windows/desktop/ms632603.aspxstructure documentation.

Remarques à l’attention des héritiers :

When overriding the P:System.Windows.Forms.Control.CreateParams property in a derived class, use the base class's P:System.Windows.Forms.Control.CreateParams property to extend the base implementation. Otherwise, you must provide all the implementation.

The following code example extends the P:System.Windows.Forms.Control.CreateParams property of a T:System.Windows.Forms.Button derived class. The P:System.Windows.Forms.CreateParams.Style property is changed, which causes the button to display an T:System.Drawing.Icon rather than an T:System.Drawing.Image. This example requires that you have a class that inherits from the T:System.Windows.Forms.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: F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode

SecurityPermission

for the immediate caller to call unmanaged code when getting the property value. Associated enumeration: F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode

.NET Framework
Disponible depuis 1.1
Retour au début
Afficher: