Export (0) Print
Expand All

Control.ControlAccessibleObject Class

Provides information about a control that can be used by an accessibility application.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[ComVisibleAttribute(true)]
public class ControlAccessibleObject : AccessibleObject

The Control.ControlAccessibleObject type exposes the following members.

  NameDescription
Public methodControl.ControlAccessibleObjectInitializes a new instance of the Control.ControlAccessibleObject class.
Top

  NameDescription
Public propertyBoundsGets the location and size of the accessible object. (Inherited from AccessibleObject.)
Public propertyDefaultActionGets a string that describes the default action of the object. Not all objects have a default action. (Overrides AccessibleObject.DefaultAction.)
Public propertyDescriptionGets the description of the Control.ControlAccessibleObject. (Overrides AccessibleObject.Description.)
Public propertyHandleGets or sets the handle of the accessible object.
Public propertyHelpGets the description of what the object does or how the object is used. (Overrides AccessibleObject.Help.)
Public propertyKeyboardShortcutGets the object shortcut key or access key for an accessible object. (Overrides AccessibleObject.KeyboardShortcut.)
Public propertyNameGets or sets the accessible object name. (Overrides AccessibleObject.Name.)
Public propertyOwnerGets the owner of the accessible object.
Public propertyParentGets the parent of an accessible object. (Overrides AccessibleObject.Parent.)
Public propertyRoleGets the role of this accessible object. (Overrides AccessibleObject.Role.)
Public propertyStateGets the state of this accessible object. (Inherited from AccessibleObject.)
Public propertyValueGets or sets the value of an accessible object. (Inherited from AccessibleObject.)
Top

  NameDescription
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDoDefaultActionPerforms the default action associated with this accessible object. (Inherited from AccessibleObject.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetChildRetrieves the accessible child corresponding to the specified index. (Inherited from AccessibleObject.)
Public methodGetChildCountRetrieves the number of children belonging to an accessible object. (Inherited from AccessibleObject.)
Public methodGetFocusedRetrieves the object that has the keyboard focus. (Inherited from AccessibleObject.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetHelpTopicGets an identifier for a Help topic and the path to the Help file associated with this accessible object. (Overrides AccessibleObject.GetHelpTopic(String).)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetSelectedRetrieves the currently selected child. (Inherited from AccessibleObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodHitTestRetrieves the child object at the specified screen coordinates. (Inherited from AccessibleObject.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodNavigateNavigates to another accessible object. (Inherited from AccessibleObject.)
Public methodNotifyClients(AccessibleEvents)Notifies accessibility client applications of the specified AccessibleEvents.
Public methodNotifyClients(AccessibleEvents, Int32)Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control.
Public methodNotifyClients(AccessibleEvents, Int32, Int32)Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control, giving the identification of the AccessibleObject.
Public methodSelectModifies the selection or moves the keyboard focus of the accessible object. (Inherited from AccessibleObject.)
Public methodToStringReturns a string that represents the current object. (Overrides Object.ToString().)
Protected methodUseStdAccessibleObjects(IntPtr)Infrastructure. Associates an object with an instance of an AccessibleObject based on the handle of the object. (Inherited from AccessibleObject.)
Protected methodUseStdAccessibleObjects(IntPtr, Int32)Infrastructure. Associates an object with an instance of an AccessibleObject based on the handle and the object id of the object. (Inherited from AccessibleObject.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIAccessible.accChildCountInfrastructure. Gets the number of child interfaces that belong to this object. For a description of this member, see IAccessible.accChildCount. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIAccessible.accDoDefaultActionInfrastructure. Performs the specified object's default action. Not all objects have a default action. For a description of this member, see IAccessible.accDoDefaultAction. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate propertyIAccessible.accFocusInfrastructure. Gets the object that has the keyboard focus. For a description of this member, see IAccessible.accFocus. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIAccessible.accHitTestInfrastructure. Gets the child object at the specified screen coordinates. For a description of this member, see IAccessible.accHitTest. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIAccessible.accLocationInfrastructure. Gets the object's current screen location. For a description of this member, see IAccessible.accLocation. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIAccessible.accNavigateInfrastructure. Navigates to an accessible object relative to the current object. For a description of this member, see IAccessible.accNavigate. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate propertyIAccessible.accParentInfrastructure. Gets the parent accessible object of this object. For a description of this member, see IAccessible.accParent. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIAccessible.accSelectInfrastructure. Modifies the selection or moves the keyboard focus of the accessible object. For a description of this member, see IAccessible.accSelect. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate propertyIAccessible.accSelectionInfrastructure. Gets the selected child objects of an accessible object. For a description of this member, see IAccessible.accSelection. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetFieldInfrastructure. Gets the System.Reflection.FieldInfo object corresponding to the specified field and binding flag. For a description of this member, see IReflect.GetField. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetFieldsInfrastructure. Gets an array of System.Reflection.FieldInfo objects corresponding to all fields of the current class. For a description of this member, see IReflect.GetFields. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetMemberInfrastructure. Gets an array of System.Reflection.MemberInfo objects corresponding to all public members or to all members that match a specified name. For a description of this member, see IReflect.GetMember. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetMembersInfrastructure. Gets an array of System.Reflection.MemberInfo objects corresponding either to all public members or to all members of the current class. For a description of this member, see IReflect.GetMembers. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetMethod(String, BindingFlags)Infrastructure. Gets a System.Reflection.MethodInfo object corresponding to a specified method under specified search constraints. For a description of this member, see IReflect.GetMethod. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetMethod(String, BindingFlags, Binder, Type[], ParameterModifier[])Infrastructure. Gets a System.Reflection.MethodInfo object corresponding to a specified method, using a Type array to choose from among overloaded methods. For a description of this member, see IReflect.GetMethod. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetMethodsInfrastructure. Gets an array of System.Reflection.MethodInfo objects with all public methods or all methods of the current class. For a description of this member, see IReflect.GetMethods. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetPropertiesInfrastructure. Gets an array of System.Reflection.PropertyInfo objects corresponding to all public properties or to all properties of the current class. For a description of this member, see IReflect.GetProperties. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetProperty(String, BindingFlags)Infrastructure. Gets a System.Reflection.PropertyInfo object corresponding to a specified property under specified search constraints. For a description of this member, see IReflect.GetProperty. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.GetProperty(String, BindingFlags, Binder, Type, Type[], ParameterModifier[])Infrastructure. Gets a System.Reflection.PropertyInfo object corresponding to a specified property with specified search constraints. For a description of this member, see IReflect.GetProperty. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate methodIReflect.InvokeMemberInfrastructure. Invokes a specified member. For a description of this member, see IReflect.InvokeMember. (Inherited from AccessibleObject.)
Explicit interface implemetationPrivate propertyIReflect.UnderlyingSystemTypeInfrastructure. Gets the underlying type that represents the IReflect object. For a description of this member, see IReflect.UnderlyingSystemType. (Inherited from AccessibleObject.)
Top

Windows Forms has accessibility support built in, and provides information about your application that enables it to work with accessibility client applications. Examples of accessibility client applications are: screen enlarger and reviewer utilities, voice input utilities, on-screen keyboards, alternative input devices, and keyboard enhancement utilities. Sometimes you will want to provide additional information to accessibility client applications. There are two ways of providing this additional information. To provide limited accessibility information for existing controls, set the control's AccessibleName, AccessibleDescription, AccessibleDefaultActionDescription, and AccessibleRole property values, which will be reported to accessibility client applications. Alternatively, if you require more accessibility information to be included with your control, you can write your own class deriving from the AccessibleObject or Control.ControlAccessibleObject classes. For example, if you are writing your own control that is not derived from the common controls or you require such operations as hit testing within your control, you should create a Control.ControlAccessibleObject for your control by calling the CreateAccessibilityInstance method.

NoteNote

If you override the AccessibleObject.GetChild method, you must also override the AccessibleObject.GetChildCount method. To get or set the AccessibilityObject property, you must add a reference to the Accessibility assembly installed with the .NET Framework.

For more information about accessible objects, see the Active Accessibility section of the MSDN Library.

The following code example creates a check box control that derives from the CheckBox class and creates a custom Control.ControlAccessibleObject for the derived class to use. The derived class, MyCheckBox, has an Appearance of Button by default so it appears as a toggle button. The derived Control.ControlAccessibleObject class, MyCheckBoxControlAccessibleObject, overrides three properties to account for the difference in appearance.

using System;
using System.Windows.Forms;
using Accessibility;
using System.Drawing;

namespace MyCustomControls
{
   public class MyCheckBox : CheckBox
   {
      public MyCheckBox()
      {
         // Make the check box appear like a toggle button. 
         this.Appearance = Appearance.Button;
         // Center the text on the button. 
         this.TextAlign = ContentAlignment.MiddleCenter;
	 // Set the AccessibleDescription text. 
         this.AccessibleDescription = "A toggle style button.";
      }

      // Create an instance of the AccessibleObject  
      // defined for the 'MyCheckBox' control 
      protected override AccessibleObject CreateAccessibilityInstance() 
      {
         return new MyCheckBoxAccessibleObject(this);
      }
   }

   // Accessible object for use with the 'MyCheckBox' control. 
   internal class MyCheckBoxAccessibleObject : Control.ControlAccessibleObject 
   {
      public MyCheckBoxAccessibleObject(MyCheckBox owner) : base(owner) 
      {

      }

      public override string DefaultAction 
      {
         get
         {
            // Return the DefaultAction based upon  
            // the state of the control. 
            if( ((MyCheckBox)Owner).Checked )
            {
               return "Toggle button up";
            }
            else
            {
               return "Toggle button down";
            }
         }
      }

      public override string Name 
      {
         get 
         {
            // Return the Text property of the control  
            // if the AccessibleName is null. 
            string name = Owner.AccessibleName;
            if (name != null) 
            {
               return name;
            }
            return ((MyCheckBox)Owner).Text;
         }

         set
         {
            base.Name = value;
         }
      }            

      public override AccessibleRole Role 
      {
         get 
         {
            // Since the check box appears like a button, 
            // make the Role the same as a button. 
            return AccessibleRole.PushButton;
         }
      }
   }
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft