Windows Mobile 6.5 Form AutoScale Properties

Developing applications for Windows Mobile 6.5 required accommodating a wide range of hardware screens, including QVGA (240x320), VGA (480x640), and WVGA (480x800). To prevent user interfaces from appearing disproportionately tiny or clipped across these varying pixel densities, the .NET Compact Framework (versions 2.0 and 3.5) utilized built-in automatic scaling mechanisms. By leveraging key properties such as AutoScaleMode and AutoScaleDimensions, developers could design a form once at a standard resolution and have the runtime scale the layout and its controls dynamically to fit higher-density displays.

Key AutoScale Properties

1. AutoScaleMode

The AutoScaleMode property determines how a form scales itself and its child controls in response to changes in screen resolution or system font sizes. In the .NET Compact Framework on Windows Mobile 6.5, the available enumeration options included:

  • Dpi: The primary setting for multi-resolution support on Windows Mobile. It instructs the form to scale based on the difference in Dots Per Inch (DPI) between the development environment and the target device. Standard QVGA operated at roughly 96 or 131 DPI, while VGA and WVGA operated at 192 DPI. Setting AutoScaleMode = AutoScaleMode.Dpi ensured proportional enlargement on high-DPI displays.
  • Inherit: Causes the container to scale according to its parent container's scaling mode.
  • None: Disables automatic scaling, leaving controls at their absolute pixel values.

2. AutoScaleDimensions

The AutoScaleDimensions property stores a SizeF value representing the DPI or font dimensions for which the form was originally designed. For standard Windows Mobile designs created in Visual Studio at standard resolution, this was typically initialized to:

this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);

When deployed to a VGA or WVGA device running at 192 DPI, the runtime uses this baseline value to calculate the scaling ratio.

3. CurrentAutoScaleDimensions

This read-only property returns the actual SizeF metrics of the device's current display at runtime. When the form loads, the .NET Compact Framework calculates a scale factor by dividing CurrentAutoScaleDimensions by AutoScaleDimensions. If the form was designed at 96 DPI and loaded onto a 192 DPI WVGA device, the runtime calculates a scaling factor of 2.0 (192 / 96) and scales coordinates, sizes, and font metrics accordingly.

4. AutoScale (Legacy)

In .NET Compact Framework 1.0, automatic scaling was managed by a simple boolean property, AutoScale = true, paired with AutoScaleBaseSize. While functional for basic proportional enlargement, this legacy method was deprecated in favor of AutoScaleMode.Dpi in later versions because it lacked the precision needed to distinguish between font scaling and raw DPI changes across screens with identical DPIs but different aspect ratios (such as VGA versus wide-aspect WVGA).

How WVGA Handled Wide Displays

While VGA (480x640) and WVGA (480x800) shared the same 192 DPI pixel density, WVGA added vertical or horizontal screen real estate. The combination of AutoScaleMode.Dpi and proper control anchoring (via the Anchor and Dock properties) allowed the UI to scale elements to the correct physical size while expanding containers to fill the extra canvas provided by the wide aspect ratio.