Edit

Share via


Providing Accessibility Information for Controls (Windows Forms .NET)

Accessibility aids are specialized programs and devices that help people with disabilities use computers more effectively. Examples include screen readers for people have blindness and voice input utilities for people who provide verbal commands instead of using the mouse or keyboard. These accessibility aids interact with the accessibility properties exposed by Windows Forms controls. These properties are:

AccessibilityObject Property

This read-only property contains an AccessibleObject instance. The AccessibleObject implements the IAccessible interface, which provides information about the control's description, screen location, navigational abilities, and value. The designer sets this value when the control is added to the form.

AccessibleDefaultActionDescription Property

This string describes the action of the control. It doesn't appear in the Properties window and can only be set in code. The following example sets the AccessibleDefaultActionDescription property for a button control:

button1.AccessibleDefaultActionDescription = "Closes the application.";
Button1.AccessibleDefaultActionDescription = "Closes the application."

AccessibleDescription Property

This string describes the control. The AccessibleDescription property can be set in the Properties window, or in code as follows:

button1.AccessibleDescription = "A button with text 'Exit'";
Button1.AccessibleDescription = "A button with text 'Exit'."

AccessibleName Property

This is the name of a control reported to accessibility aids. The AccessibleName property can be set in the Properties window, or in code as follows:

button1.AccessibleName = "Order";
Button1.AccessibleName = "Order"

AccessibleRole Property

This property, which contains an AccessibleRole enumeration, describes the user interface role of the control. A new control has the value set to Default. This means that by default, a Button control acts as a Button. Setting this property to another value might help if the control has another role. For example, you might be using a PictureBox control to display a chart, and you might want accessibility aids to report the role as a Chart, not as a PictureBox. You might also want to specify this property for your custom controls. You can set this property in the Properties window, or in code as follows:

pictureBox1.AccessibleRole = AccessibleRole.Chart;
PictureBox1.AccessibleRole = AccessibleRole.Chart

See also