Working with the Form Control


Working with the Form Control

The Form control is the container for an application's entire user interface. The Form control is the actual window that contains the application's controls. The Form class has several properties that cause the form to act differently depending on the target platform.

Understanding the Effects of the FormBorderStyle Property

The FormBorderSytle property determines the border style of the form. The default value for this feature is FormBorderStyle.FixedSingle .

On the Pocket PC, setting the property to FormBorderStyle.None creates a form with no border and no title bar. This type of form can be resized and moved in code but not by the user. Setting the property FillBorderStyle.FixedSingle or any other value will create a form that fills the desktop area, and the form will not be movable or resizable.

On the Windows CE .NET, setting the property to FormBorderStyle.FixedDialog or FormBorderStyle.None will create a form with no border or title bar. The form will be movable and resizable through code only. Setting the property to FormBorderStyle.FixedSingle or any other value will create a form sized to the Size property with a border and a title bar. The form will only be resizable or moved through code, and the user will be able to move the form.

Using the ControlBox Property

The form's ControlBox property determines whether the control box is displayed. Setting the ControlBox property to true will display the control box. Set the property to false to hide the control box.

Understanding the MinimizeBox and MaximizeBox Properties

On Pocket PC the control box only contains at most one button, either the minimize button, labeled X, or the close button, labeled OK. On Windows CE .NET the control box can contain the minimize button, the maximize button, and the close button. The visibility of these buttons is controlled by the MinimizeBox and MaximizeBox properties. Table 3.1 describes the possible values of the MinimizeBox and their effects on each target platform. Table 3.2 does the same for the MaximizeBox property.

Table 3.1. The Possible Values for the MinimizeBox Property and Their Effects on Each Target Platform

PROPERTY VALUE

POCKET PC APPLICATION

WINDOWS CE .NET APPLICATION

True

X (minimize) button in the title bar

Traditional windows' minimize button in the title bar.

False

OK (close) button in the title bar

There is no minimize button in the title bar.

Table 3.2. The Possible Values for the MaximizeBox Property and Their Effects on Each Target Platform

PROPERTY VALUE

POCKET PC APPLICATION

WINDOWS CE .NET APPLICATION

True

No effect

Traditional windows' maximize button in the title bar.

False

No effect

There is no maximize button in the title bar.

Understanding the WindowsState Property

The WindowsState property determines the initial visible state of the window. This property can be set only to FormWindowState.Normal or FormWindowState.Maximized . Table 3.3 describes each value and its effect on an application running on both target platforms.

Table 3.3. The Possible Values for the WindowState Property and Their Effects on Each Target Platform

FormWindowState MEMBER NAME

POCKET PC APPLICATION

WINDOWS CE .NET APPLICATION

Normal

The application will fill the entire desktop area, which is the entire screen area minus the area of the start menu and the area of the main menu bar.

The application is sized according to the Size property.

Maximize

The application fills the entire screen. This will hide the start menu, but the main menu will still be visible.

The application fills the entire desktop area.

Understanding the Size Property

The Size property determines the size of the application window. Depending on the value of the FormBorderStyle property, the application can either ignore the value of the Size property or draw the application at the specified size. On Pocket PC, in order for the Size property to be honored, the FormBorderStyle must be set to FormBorderSytle.None . On Windows CE the Size property is always honored.

Setting the Location of the Form by Using the Location Property

The Location property determines the position of the top-left corner of the form. On Pocket PC the Location property has no effect unless the FormBorderSytle property is set to FormBorderSytle.None . On Windows CE the location of the window is always equal to the Location property, unless the application been put in the minimized or maximized state.



Microsoft.NET Compact Framework Kick Start
Microsoft .NET Compact Framework Kick Start
ISBN: 0672325705
EAN: 2147483647
Year: 2003
Pages: 206

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