Export (0) Print
Expand All
Expand Minimize

Control.SetBoundsCore Method

Performs the work of setting the specified bounds of this control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

'Declaration
Protected Overridable Sub SetBoundsCore ( _
	x As Integer, _
	y As Integer, _
	width As Integer, _
	height As Integer, _
	specified As BoundsSpecified _
)
'Usage
Dim x As Integer 
Dim y As Integer 
Dim width As Integer 
Dim height As Integer 
Dim specified As BoundsSpecified 

Me.SetBoundsCore(x, y, width, height, _
	specified)

Parameters

x
Type: System.Int32

The new Left property value of the control.

y
Type: System.Int32

The new Top property value of the control.

width
Type: System.Int32

The new Width property value of the control.

height
Type: System.Int32

The new Height property value of the control.

specified
Type: System.Windows.Forms.BoundsSpecified

A bitwise combination of the BoundsSpecified values.

Typically, the parameters that correspond to the bounds not included in the specified parameter are passed in with their current values. 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. However all values passed in are honored and applied to the control.

The boundsSpecified parameter represents the elements of the controls Bounds changed by your application. For example, if you change the Size of the control, the boundsSpecified parameter value is the Size value of 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.

NoteNote:

On Windows Server 2003 systems, the size of a Form is restricted by the maximum pixel width and height of the monitor.

Notes to Inheritors:

When overriding SetBoundsCore in a derived class, be sure to call the base class's SetBoundsCore method to force the bounds of the control to change. Derived classes can add size restrictions to the SetBoundsCore method.

The following code example overrides the SetBoundsCore method to ensure that the control remains a fixed size. This example requires that you have a class that is either directly or indirectly derived from the Control class.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft