Working with the Form ControlThe 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 PropertyThe 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 PropertyThe 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 PropertiesOn 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
Table 3.2. The Possible Values for the MaximizeBox Property and Their Effects on Each Target Platform
Understanding the WindowsState PropertyThe 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
Understanding the Size PropertyThe 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 PropertyThe 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. |