Control.SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Metoda
Definicja
Wykonuje zadanie ustawiania określonych granic tej kontrolki.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)
Parametry
- specified
- BoundsSpecified
Bitowa kombinacja BoundsSpecified wartości.A bitwise combination of the BoundsSpecified values.
Przykłady
Poniższy przykład kodu przesłania metodę, SetBoundsCore Aby upewnić się, że formant pozostaje stały rozmiar.The following code example overrides the SetBoundsCore method to ensure that the control remains a fixed size. Ten przykład wymaga, aby istnieje Klasa, która jest bezpośrednio lub pośrednio pochodną Control klasy.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
Uwagi
Zwykle parametry, które odpowiadają granicom niezawartym w specified
parametrze, są przesyłane przy użyciu ich bieżących wartości.Typically, the parameters that correspond to the bounds not included in the specified
parameter are passed in with their current values. Na przykład, Height Width , lub X właściwości lub właściwości Y Location mogą być przesyłane w odniesieniu do bieżącego wystąpienia formantu.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. Wszystkie wartości, które zostały przesłane, są honorowane i stosowane do kontrolki.However all values passed in are honored and applied to the control.
boundsSpecified
Parametr reprezentuje elementy kontrolek Bounds zmienione przez aplikację.The boundsSpecified
parameter represents the elements of the controls Bounds changed by your application. Na przykład jeśli zmienisz Size kontrolkę, boundsSpecified
wartość parametru jest równa Size
wartości BoundsSpecified .For example, if you change the Size of the control, the boundsSpecified
parameter value is the Size
value of BoundsSpecified. Jeśli jednak Size zostanie on dostosowany w odpowiedzi na Dock ustawioną właściwość, boundsSpecified
wartość parametru jest równa None
wartości 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.
Uwaga
W systemach Windows Server 2003 rozmiar a Form jest ograniczony przez maksymalną szerokość i wysokość pikseli na monitorze.On Windows Server 2003 systems, the size of a Form is restricted by the maximum pixel width and height of the monitor.
Uwagi dotyczące dziedziczenia
Podczas zastępowania SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) klasy pochodnej należy wywołać metodę klasy bazowej, SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) Aby wymusić zmianę granic formantu.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. Klasy pochodne mogą dodawać ograniczenia rozmiaru do SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) metody.Derived classes can add size restrictions to the SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified) method.