Methods


The following table lists useful methods implemented by the Control class. All controls that inherit from this class inherit these properties unless they override the Control class’s behavior.

Open table as spreadsheet

Method

Purpose

Sub BringToFront()

Brings the control to the front of the stacking order.

Function Contains(ByVal child As Control) As Boolean

Returns True if the control child is contained by this control.

Function CreateGraphics() As Graphic

Creates a Graphic object that you can use to draw on the control’s surface.

Function DoDragDrop(ByVal dragging_object As Object, ByVal allowed_effects As DragDropEffects)

Starts a drag-and-drop operation.

Sub DrawToBitmap(ByVal bm As Bitmap, ByVal rect As Rectangle)

Draws an image of the control including contained controls onto the Bitmap in the indicated Rectangle.

Function FindForm() As Form

Returns the Form that contains this control.

Function Focus() As Boolean

Gives the control the input focus.

Function GetChildAtPoint (ByVal pt As Point) As Control

Returns the control’s child that contains the indicated point. If more than one control contains the point, the method returns the control that is higher in the stacking order.

Function GetNextControl (ByVal ctl As Control, ByVal next As Boolean) As Control

If next is True, returns the next control in the tab order of this control’s children after control ctl. If next is False, returns the previous control in the tab order. Set ctl = Nothing to start from the start/end of the tab order. Returns Nothing when you reach the start/end.

Function GetPreferredSize (ByVal proposed_size) As Size

Returns a size that is big enough to hold the control’s contents.

Function GetType() As Type

Returns a Type object representing the control’s class. You can use this object to get information about the class.

Sub Hide()

Hides the control by setting its Visible property to False.

Sub Invalidate()

Invalidates some or all of the control and sends it a Paint event so that it redraws itself.

Sub Invoke(ByVal delegate As Delegate)

Invokes a delegate on the thread that owns the control.

Function PointToClient (ByVal screen_point As Point) As Point

Converts a Point in screen coordinates into the control’s coordinate system.

Function PointToScreen (ByVal control_point As Point) As Point

Converts a Point in control coordinates into the screen coordinate system.

Function RectangleToClient (ByVal screen_rect As Rectangle) As Rectangle

Converts a Rectangle in screen coordinates into the control’s coordinate system.

Function RectangleToScreen (ByVal control_rect As Rectangle) As Rectangle

Converts a Rectangle in control coordinates into the screen coordinate system.

Sub Refresh()

Invalidates the control’s client area, so the control redraws itself and its child controls.

Sub ResetBackColor()

Resets the control’s background color to its default value.

Sub ResetCursor()

Resets the control’s cursor to its default value.

Sub ResetFont()

Resets the control’s font to its default value.

Sub ResetForeColor()

Resets the control’s foreground color to its default value.

Sub ResetText()

Resets the control’s text to its default value.

Sub Scale(ByVal scale_factor As Single)

Scales the control and any contained controls by multiplying the Left, Top, Width, and Height properties by scale_ factor.

Sub Select()

Moves the input focus to the control. Some controls have overloaded versions.

Function SelectNextControl (ByVal ctl As Control, ByVal forward As Boolean, ByVal tab_stop_only As Boolean, ByVal include_ nested As Boolean, ByVal wrap As Boolean) As Boolean

Moves the input focus to the next control contained within this one.

Sub SendToBack()

Sends the control to the back of the stacking order.

Sub SetBounds(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)

Sets the control’s position and size.

Sub Show()

Displays the control by setting its Visible property to True

Function ToString() As String

Returns a textual representation of the control. This is generally the type of the control followed by its most commonly used property.

Sub Update()

Makes the control redraw any invalidated areas.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net