Name
Form
Synopsis
A Form is a specialization of
Control that supports top-level windows such as
tool windows, frame windows, application pop-ups, and MDI child
windows.
The appearance of the form’s non-client imagery can
be set using the FormBorderStyle to determine the
basic appearance, along with the SizeGripStyle to
determine whether to show the resizing grippy. The non-client
controls are enabled and disabled with the
ControlBox (which enables the system menu and
close button), MaximizeBox,
MinimizeBox, and HelpButton
properties. You can also set the Icon to use for
the ControlBox.
The Form can also show a Menu,
and a MergedMenu can be retrieved for the current
context if you are using the MDI idiom.
You can create and Show() a form modelessly as
with any other control, or use the ShowDialog()
method to create and show a modal window. The
Modal property can be used to determine which
method is used to display the form. How the Form
is initially positioned is determined by the
StartPosition property. You can subsequently
minimize or maximize the form by setting the
WindowState. It will float above all other windows
if you set TopMost to true. While it is showing,
it can be made to appear in the taskbar by setting the
ShowInTaskbar property.
When the Form is closed, the ShowDialog() method returns the DialogResult.
Default button processing is handled through the
AcceptButton and CancelButton
properties. You can assign any
IButtonControl-derived class to this property (which includes ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access