Partager via


Controls in the .NET Compact Framework

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The following table lists the controls, components, and types for developing Windows Forms applications that are provided by the .NET Compact Framework, with implementation notes where applicable.

You can load and create instances of data and controls in the constructor of the form, but positioning the control and setting other properties is best performed in the Load event handler.

Control or component

Pocket PC

Smartphone

Notes

Button

Yes

No

For information about creating custom button controls, see Custom Control Development.

CheckBox

Yes

Yes

 

Clipboard

Yes

Yes

Supported in version 2.0.

ComboBox

Yes

Yes

The default value for the DropDownStyle property is DropDownList.

ContextMenu

Yes

No

A shortcut menu created for a child form remains displayed when the child form is destroyed.

Control

Yes

Yes

You can use this control as a base for custom controls.

Cursor and Cursors

Yes

Yes

The .NET Compact Framework supports only the Current property for a Cursor, and the WaitCursor and Default cursors.

DataGrid

Yes

Yes

The DataGrid class for the .NET Compact Framework is in a separate assembly. You must add a reference to System.Windows.Forms.DataGrid.dll in your project to use it. For more information, see Using the DataGrid in the .NET Compact Framework.

DateTimePicker

Yes

Yes

This control requires Windows Mobile version 5.0 for Smartphone. For more information, see How to: Use the DateTimePicker Class in the .NET Compact Framework.

DocumentList

Yes

No

Displays and manages documents. See How to: Use a DocumentList Control.

This control is available only in the .NET Compact Framework.

DomainUpDown

Yes

Yes

The Height property resizes the control, unlike in the full .NET Framework.

This control does not perform input validation.

The SelectedItemChanged event occurs only when you click the up or down arrows, not when you type text into the control.

Form

Yes

Yes

On the Pocket PC, the FormBorderStyle property supports only the None and FixedSingle values. On the Smartphone, the FormBorderStyle property is not available.

Although the .NET Compact Framework supports the Icon property for a form, the icon does not appear in Pocket PC and Smartphone applications by design.

HardwareButton

Yes

No

Provides override capabilities for buttons on the Pocket PC hardware. See How to: Use the HardwareButton Component.

Help

Yes

No

Displays HTML Help files used for Pocket PC help. See How to: Display User Help.

HScrollBar

Yes

Yes

 

ImageList

Yes

Yes

 

InputPanel

Yes

No

Manipulates the soft input panel (SIP) on a Pocket PC. See How to: Use the InputPanel Component.

This control is available only in the .NET Compact Framework.

InputPanel.InputMethodCollection

Yes

No

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

This control is available only in the .NET Compact Framework.

InputMode

No

Yes

See How to: Set Smartphone Input Modes.

This control is available only in the .NET Compact Framework.

LinkLabel

Yes

No

Limited support of a basic hyperlink automatically formatted as underlined and blue.

Label

Yes

Yes

Setting the background color to transparent is not supported on the .NET Compact Framework. For labels, use the DrawString method instead of a label control to achieve a similar effect.

ListBox and ListControl

Yes

Yes

If there are no items in the list, the Text property cannot be set. In the full .NET Framework, the value is retained but ignored.

The .NET Compact Framework does not support selecting multiple items.

Setting the ListControl.SelectedValue property works only if the control is data bound.

ListView

Yes

Yes

The .NET Compact Framework does not support the Sort method. To work around this issue, see How to: Sort ListView Items.

The .NET Compact Framework does not support selecting multiple items.

LogFont

Yes

Yes

Defines a logical font (LogFont) structure for text effects such as angled text.

This class is available only in the .NET Compact Framework.

MainMenu

Yes

Yes

You cannot add a menu item at the ordinal location of a menu separator. The .NET Compact Framework throws an exception and the full .NET Framework ignores this action.

You cannot display an ampersand (&) in menu item text.

MessageBox

Yes

Yes

Windows Mobile for Smartphone supports only 1-button or 2-button message boxes.

MessageWindow

Yes

Yes

Provides the capability to generate and receive Windows messages. For an example, see How to: Use the MessageWindow Class.

This class is available only in the .NET Compact Framework.

MonthCalendar

Yes

Yes

 

Notification

Yes

No

Displays and responds to user notifications. For an example, see How to: Send a Notification.

MobileDevice

Yes

Yes

This class provides the Hibernate event, which provides an opportunity to release cached resources.

This class is available only in the .NET Compact Framework.

NumericUpDown

Yes

Yes

The Height property resizes the control, unlike in the full .NET Framework.

Unlike in the full .NET Framework, this control does not perform input validation. The ValueChanged event occurs only when you click the up or down arrows.

Decimal values are treated as integers. A specification of 10.25 or 10.75, for example, is truncated to 10. Values greater than a 16-bit signed integer are not supported on a Pocket PC.

Each time you get the Value property, the value returned is a multiple of the specified Increment property value. For example, if Increment is 3, Minimum is 0, and Maximum is 100, the subsequent values after selecting the up arrow are 3, 6, 9, 12, and so on. When the value approaches the minimum or maximum, it will always be set to that value and can never go beyond it. When the value is 100 and you click the down arrow, a value of 97 might be expected (100 – 3). However, because 97 is not a multiple of the increment value of 3, the control continues decrementing until it finds a multiple of 3, thus setting the value to 96.

OpenFileDialog

Yes

No

The initial directory is restricted to the My Documents folder and its subfolders. This restriction is imposed by the Pocket PC operating system to help users organize their files in the standard directories.

Panel

Yes

Yes

 

PictureBox

Yes

Yes

 

ProgressBar

Yes

Yes

 

RadioButton

Yes

No

 

SaveFileDialog

Yes

No

 

ScreenOrientation

Yes

Yes

Allows you to change the screen orientation value to 90, 180, or 270 without resetting the device. For more information, see How to: Handle Orientation and Resolution Changes.

This class requires Windows Mobile version 5.0 software for Pocket PCs and Smartphones. This class is available only in the .NET Compact Framework.

Splitter

Yes

No

 

StatusBar

Yes

No

Always docks to the bottom of the form. Its size cannot be changed.

TabControl

Yes

No

The TabControl is initially sized to occupy the full client area of the form. Undock the control to resize it.

TabPage

Yes

No

 

TextBox

Yes

Yes

Single-line TextBox controls, specified by the Multiline property, support only left alignment. Multiline text box controls can be aligned left, right, or center.

If Multiline is false, the .NET Compact Framework sizes the control to the Height specification, but only the first line in the TextBox is usable. The full .NET Framework keeps the height to one line.

The PasswordChar property is always an asterisk (*), regardless of what is specified.

The Smartphone does not support the BorderStyle property.

Timer

Yes

Yes

 

ToolBar

Yes

No

A Form supports only one ToolBar. An attempt to add an additional ToolBar throws a NotSupportedException.

Setting the image index of a ToolBar button before setting the ImageList property of the ToolBar is not supported.

TrackBar

Yes

No

 

TreeView

Yes

Yes

The .NET Compact Framework does not support the Click event for a TreeView. An alternative is to use the AfterSelect event. To obtain functionality from the native TreeView control, see How to: Subclass a TreeView by Using Native Callbacks.

VScrollBar

Yes

Yes

Cannot be set to the maximum value, because similar to the NumericUpDown control, the maximum achievable value is the first empty row above the thumb. More specifically, this equates to: Maximum minus LargeChange plus 1.

WebBrowser

Yes

Yes

See How to: Use the WebBrowser Control in the .NET Compact Framework.

See Also

Other Resources

Windows Forms Controls in the .NET Compact Framework