Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Método
Definición
Realiza la tarea de configurar los límites especificados de este control.Performs the work of setting the specified bounds of this control.
protected:
virtual void SetBoundsCore(int x, int y, int width, int height, System::Windows::Forms::BoundsSpecified specified);
protected virtual void SetBoundsCore (int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified);
abstract member SetBoundsCore : int * int * int * int * System.Windows.Forms.BoundsSpecified -> unit
override this.SetBoundsCore : int * int * int * int * System.Windows.Forms.BoundsSpecified -> unit
Protected Overridable Sub SetBoundsCore (x As Integer, y As Integer, width As Integer, height As Integer, specified As BoundsSpecified)
Parámetros
- width
- Int32
Nuevo valor de la propiedad Width del control.The new Width property value of the control.
- height
- Int32
Nuevo valor de la propiedad Height del control.The new Height property value of the control.
- specified
- BoundsSpecified
Combinación bit a bit de los valores de BoundsSpecified.A bitwise combination of the BoundsSpecified values.
Ejemplos
En el ejemplo de código siguiente se invalida el método SetBoundsCore para asegurarse de que el control sigue siendo un tamaño fijo.The following code example overrides the SetBoundsCore method to ensure that the control remains a fixed size. En este ejemplo se requiere que tenga una clase que se deriva directa o indirectamente de la clase Control.This example requires that you have a class that is either directly or indirectly derived from the Control class.
protected:
virtual void SetBoundsCore( int x, int y, int width, int height, BoundsSpecified specified ) override
{
// Set a fixed height and width for the control.
UserControl::SetBoundsCore( x, y, 150, 75, specified );
}
protected override void SetBoundsCore(int x, int y,
int width, int height, BoundsSpecified specified)
{
// Set a fixed height and width for the control.
base.SetBoundsCore(x, y, 150, 75, specified);
}
Protected Overrides Sub SetBoundsCore(x As Integer, _
y As Integer, width As Integer, _
height As Integer, specified As BoundsSpecified)
' Set a fixed height and width for the control.
MyBase.SetBoundsCore(x, y, 150, 75, specified)
End Sub
Comentarios
Normalmente, los parámetros que se corresponden con los límites no incluidos en el parámetro specified
se pasan con sus valores actuales.Typically, the parameters that correspond to the bounds not included in the specified
parameter are passed in with their current values. Por ejemplo, las propiedades Height, Width o X o Y de la propiedad Location se pueden pasar con una referencia a la instancia actual del control.For example, the Height, Width, or the X or Y properties of the Location property can be passed in with a reference to the current instance of the control. Sin embargo, todos los valores que se pasan se respetan y se aplican al control.However all values passed in are honored and applied to the control.
El parámetro boundsSpecified
representa los elementos de los controles Bounds modificados por la aplicación.The boundsSpecified
parameter represents the elements of the controls Bounds changed by your application. Por ejemplo, si cambia el Size del control, el valor del parámetro boundsSpecified
es el valor Size
de BoundsSpecified.For example, if you change the Size of the control, the boundsSpecified
parameter value is the Size
value of BoundsSpecified. Sin embargo, si el Size se ajusta en respuesta a la propiedad Dock que se establece, el valor del parámetro boundsSpecified
es el valor None
de BoundsSpecified.However, if the Size is adjusted in response to the Dock property being set, the boundsSpecified
parameter value is the None
value of BoundsSpecified.
Nota
En los sistemas Windows Server 2003, el tamaño de un Form está restringido por el ancho máximo en píxeles y el alto del monitor.On Windows Server 2003 systems, the size of a Form is restricted by the maximum pixel width and height of the monitor.
Notas a los desarrolladores de herederos
Al reemplazar SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) en una clase derivada, asegúrese de llamar al método SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) de la clase base para forzar el cambio de los límites del control.When overriding SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) in a derived class, be sure to call the base class's SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) method to force the bounds of the control to change. Las clases derivadas pueden agregar restricciones de tamaño al método SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified).Derived classes can add size restrictions to the SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) method.