Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

Propiedad Control.CreateParams

 

Publicado: octubre de 2016

Obtiene los parámetros de creación necesarios cuando se crea el identificador del control.

Espacio de nombres:   System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)

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

Valor de propiedad

Type: System.Windows.Forms.CreateParams

CreateParams que contiene los parámetros de creación necesarios cuando se crea el identificador del control.

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.

Notas para desarrolladores de herederos:

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 desde 1.1
Volver al principio
Mostrar: