Built-in Controls

Windows provides several kinds of widely used controls, such as buttons and text boxes, which act as the fundamental building blocks in most user interfaces. All these standard control types have .NET equivalents. This section shows which controls are available and what their Win32 equivalents are. It also describes some of the issues common to all the standard controls. More detailed technical descriptions of each control can be found in the reference section.

Available Controls

Table 2-1 shows the list of available controls and the nearest equivalent window class in Win32. (Some Win32 classes, such as Button, have several different modes, each of which is represented by a different class in Windows Forms. In this case, a Win32 window style is also specified to indicate which particular flavor of this class the relevant .NET type represents.)

Table 2-1. .NET controls and their equivalent Win32 control classes

Control class

Equivalent Win32 window class (and style)

Purpose

Buttons

  
Button
Button 

(BS_PUSHBUTTON)

Normal button for actions (e.g., OK or Cancel)

CheckBox
Button (BS_CHECKBOX)

Yes/no selection button

RadioButton
Button 

(BS_RADIOBUTTON)

Single selection from a range of choices

Labels and pictures

  
GroupBox
Button (BS_GROUPBOX)

Visual grouping for sets of related controls

Label
Static (SS_LEFT, 

SS_CENTER, SS_RIGHT)

Text label, usually providing a name or description for some other control (e.g., a text box)

PictureBox
Static ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.