Windows Forms and Graphics

This .NET Compact Framework version 2.0 provides expanded user interface capabilities with the following features:

  • More .NET Compact Framework–specific controls in the Microsoft.WindowsCE.Forms namespace.

  • Expanded support for controls and classes in the System.Windows.Forms namespace.

  • Greater drawing and graphics support.

  • Auto-scrollable forms.

  • Clipboard support.

  • Keyboard events.

  • Pocket PC–specific features.

  • Smartphone-specific features.

  • Improved shutdown of Windows Forms applications and object destruction.

  • Support for integrated keyboards on the Pocket PC.

  • Support for changes in screen orientation and resolution. See How to: Handle Orientation and Resolution Changes.

New and Changed Types in Microsoft.WindowsCE.Forms

The following table summarizes the new classes and other changes in the Microsoft.WindowsCE.Forms namespace. For a list of controls that you can use, see Windows Forms Controls in the .NET Compact Framework.

Type

Description

Notification

Displays and responds to user notifications.

DocumentList

Displays and manages documents.

HardwareButton

Provides override capabilities for buttons on the Pocket PC hardware.

InputPanel.InputMethodCollection

Provides access to all input method software installed on a Pocket PC.

InputMode

Supported on Smartphone 2003.

LogFont

Defines a logical font object for text effects such as angled text.

MessageWindow

Provides the new Text property. You can use this property to set and get the text of a MessageWindow.

MobileDevice

Provides the Hibernate event, which allows you to free cached resources as warranted.

ScreenOrientation

Allows you to change the screen orientation value to 90, 180, or 270 without resetting the device.

Requires Pocket PCs running Windows Mobile 2003 Second Edition.

Windows Forms Support

The following table summarizes the expanded support in the .NET Compact Framework 2.0 for classes in the System.Windows.Forms namespace.

Control or feature

Expanded support

Clipboard

Support includes copying and pasting a DataObject.

ComboBox

Support for the DropDownStyle property.

Control

Version 2.0 supports the following members:

DateTimePicker

See How to: Use the DateTimePicker Class in the .NET Compact Framework.

Design time experience

Docking, anchoring, and Splitter are supported.

Font collection

Supported.

ForeColor and BackColor properties

Supported on common controls.

Form control

Support for the following members:

Better performance with full-screen forms.

Form.Load event

The form is made visible after the Form.Load event occurs. This may affect applications that perform custom drawing or show another form during the event.

Help

This class is supported along with the Help events and event-handler classes. For an example, see How to: Display User Help. The HelpProvider class, however, is not supported.

Key events

Supported on common controls.

KeyPreview property

Supported on common controls. You can use the KeyPreview property to trap keyboard events from integrated keyboards.

LinkLabel

Supported, but only provides a basic hyperlink, which is automatically formatted as underlined and blue.

ListView

The EnsureVisible method is supported.

Menus and tool bars

The command bar of a child window in a Pocket PC application is brought to the top of the z-order when it is added. This causes the command bar to hide any lower z-order controls that overlap the command bar client area.

MonthCalendar

Supported.

Owned modal dialogs

Supported.

PictureBox

Supported.

ProgressBar

Supported.

ScrollableControl

Supported.

Tabbing and focus

The .NET Compact Framework version 2.0 supports the TabIndexandTabStop properties, but does not support the UpdateZOrdermethod. In version 2.0, you are no longer required to explicitly set the first control to receive the focus.

If a form contains a control that can be tabbed, the control gets focus when the form is displayed. This matches the full .NET Framework behavior and aids keyboard navigation.

Setting the Focus property returns true only if the focus was successfully set to the new control. If the target control is disabled, or if the focus is removed from the target control in a GotFocus event or in a LostFocus event, the Focus method returns false.

Tabbing occurs among controls that are children to a custom control.

TabControl

There are no behavior restrictions, and you can control the width. By default, the control is docked to the top to maintain version 1.0 behavior.

TextBox

The following is supported:

Threading

A NotSupportedException is thrown when a control is accessed from a thread other than the one it was created on without using the Invoke method.

ToolBar

Button tooltips are supported.

TrackBar

Removing tick marks is supported.

TreeView

The following members are supported:

Selecting an item with the ENTER key is supported.

UserControl

Supported.

WebBrowser

Full support requires Windows Mobile Version 5.0 for Pocket PCs and Smartphones. For more information, see How to: Use the WebBrowser Control in the .NET Compact Framework.

Graphics Support

The .NET Compact Framework 2.0 has expanded support for drawing and using graphic objects with the following features:

DirectX and Direct3D

The .NET Compact Framework 2.0 provides classes for developing mobile applications using managed DirectX and Direct3D classes. However, running the applications requires Windows Mobile version 5.0 software for Pocket PC and Windows Mobile version 5.0 for Smartphone. For more information and How-to topics, see Mobile Direct3D Programming in the .NET Compact Framework.

Pocket PC Features

The .NET Compact Framework 2.0 provides the following features for the Pocket PC:

For more information, see Pocket PC Development and the .NET Compact Framework.

Smartphone Features

The .NET Compact Framework 2.0 provides the following expanded support for the Smartphone:

For more information, see Smartphone Development and the .NET Compact Framework.

Improved Shutdown

Closing applications has improved in two ways:

  • The Dispose method is called in all cases when a control is destroyed, providing for a better shutdown.

  • When the main form is closed, the .NET Compact Framework destroys windows in a top-down manner.

See Also

Concepts

.NET Framework Support and New Features

Reference

Supported Classes in the .NET Compact Framework

Other Resources

Windows Forms Controls in the .NET Compact Framework

What's New in the .NET Compact Framework Version 2.0