Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Method

Definição

Executa o trabalho de configurar os limites especificados desse controle.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

x
Int32 Int32 Int32 Int32

O novo valor da propriedade Left do controle.The new Left property value of the control.

y
Int32 Int32 Int32 Int32

O novo valor da propriedade Top do controle.The new Top property value of the control.

width
Int32 Int32 Int32 Int32

O novo valor da propriedade Width do controle.The new Width property value of the control.

height
Int32 Int32 Int32 Int32

O novo valor da propriedade Height do controle.The new Height property value of the control.

specified
BoundsSpecified BoundsSpecified BoundsSpecified BoundsSpecified

Uma combinação bit a bit dos valores BoundsSpecified.A bitwise combination of the BoundsSpecified values.

Exemplos

O exemplo de código a seguir SetBoundsCore substitui o método para garantir que o controle permaneça um tamanho fixo.The following code example overrides the SetBoundsCore method to ensure that the control remains a fixed size. Este exemplo requer que você tenha uma classe que seja direta ou indiretamente derivada da Control classe.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

Comentários

Normalmente, os parâmetros que correspondem aos limites não incluídos no specified parâmetro são passados com seus valores atuais.Typically, the parameters that correspond to the bounds not included in the specified parameter are passed in with their current values. Por exemplo, as Height Y propriedades Width,, ou X da Location Propriedade podem ser passadas com uma referência à instância atual do controle.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. No entanto, todos os valores passados são respeitados e aplicados ao controle.However all values passed in are honored and applied to the control.

O boundsSpecified parâmetro representa os elementos dos controles Bounds alterados pelo seu aplicativo.The boundsSpecified parameter represents the elements of the controls Bounds changed by your application. Por exemplo, se você alterar o Size do controle, o boundsSpecified valor do parâmetro será o Size valor de BoundsSpecified.For example, if you change the Size of the control, the boundsSpecified parameter value is the Size value of BoundsSpecified. No entanto, Size se o for ajustado em resposta Dock à propriedade que está sendo boundsSpecified definida, o valor None do parâmetro BoundsSpecifiedserá o valor de.However, if the Size is adjusted in response to the Dock property being set, the boundsSpecified parameter value is the None value of BoundsSpecified.

Observação

Nos sistemas Windows Server 2003, o tamanho de a Form é restrito pela largura e altura máximas do pixel do monitor.On Windows Server 2003 systems, the size of a Form is restricted by the maximum pixel width and height of the monitor.

Notas aos Herdeiros

Ao substituir SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) em uma classe derivada, certifique-se de chamar o método da SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) classe base para forçar a alteração dos limites do controle.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. Classes derivadas podem adicionar restrições de tamanho ao SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) método.Derived classes can add size restrictions to the SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) method.

Aplica-se a

Veja também