Appendix J

Form Objects

This appendix describes the most useful properties, methods, and events provided by the Windows Form class.

The Form class inherits indirectly from the Control class (Control is the Form class’s “great-grandparent”), so in many ways, a form is just another type of control. Except where overridden, Form inherits the properties, methods, and events defined by the Control class. Chapter 8, “Using Windows Forms Controls,” discusses some of the more useful properties, methods, and events provided by the Control class, and most of those apply to the Form class as well. Appendix A, “Useful Control Properties, Methods, and Events,” summarizes the Control class’s most useful properties.

PROPERTIES

The following table describes some of the most useful Form properties.

PROPERTY DESCRIPTION
AutoScroll Determines whether the form automatically provides scroll bars when it is too small to display all of the controls it contains.
AutoScrollMargin If AutoScroll is True, the control will provide scroll bars if necessary to display its controls plus this much margin.
AutoScrollPosition Adjusts the AutoScroll scroll bars so this point on the form is placed at the upper-left corner of the visible area (if possible). For example, if a button has location (100, 20), the statement AutoScrollPosition = New Point(100, 20) scrolls the form so the button is in the upper-left corner of the visible area.
BackColor Determines the form’s background color.
BackgroundImage ...

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.