AccessibleNavigation (Enumeración)
Actualización: noviembre 2007
Especifica valores para desplazarse entre los objetos accesibles.
Ensamblado: System.Windows.Forms (en System.Windows.Forms.dll)
| Nombre de miembro | Descripción | |
|---|---|---|
| Down | Desplazamiento a un objeto relacionado ubicado debajo del objeto inicial. | |
| FirstChild | Desplazamiento al primer secundario del objeto. | |
| LastChild | Desplazamiento al último secundario del objeto. | |
| Left | Desplazamiento al objeto relacionado ubicado a la izquierda del objeto inicial. | |
| Next | Desplazamiento al objeto lógico siguiente; normalmente, de un objeto relacionado al objeto inicial. | |
| Previous | Desplazamiento al objeto lógico anterior; normalmente, de un objeto relacionado al objeto inicial. | |
| Right | Desplazamiento al objeto relacionado ubicado a la derecha del objeto inicial. | |
| Up | Desplazamiento a un objeto relacionado ubicado encima del objeto inicial. |
Las direcciones de desplazamiento accesibles son espaciales (arriba, abajo, izquierda y derecha) o lógicas (primer secundario, último secundario, siguiente y anterior). Las direcciones lógicas se utilizan cuando los clientes se desplazan de un elemento de la interfaz de usuario a otro elemento del mismo contenedor.
AccessibleObject utiliza esta enumeración.
Para obtener más información sobre la aplicación de accesibilidad, busque el tema "Microsoft Active Accessibility" en MSDN Library.
En el siguiente ejemplo de código se muestra el proceso de creación de un control de gráfico con reconocimiento de accesibilidad mediante las clases AccessibleObject y Control.ControlAccessibleObject con el fin de exponer información accesible. El control dibuja dos curvas acompañadas de una leyenda. La clase ChartControlAccessibleObject, que se deriva de ControlAccessibleObject, se utiliza en el método CreateAccessibilityInstance a fin de proporcionar información personalizada accesible para el control de gráfico. Como la leyenda del gráfico no es un control real basado en Control, sino que se dibuja mediante el control de gráfico, no proporciona ninguna información accesible integrada. Debido a esto, la clase ChartControlAccessibleObject reemplaza el método GetChild para devolver CurveLegendAccessibleObject que representa la información accesible de cada parte de la leyenda. Cuando este control se utiliza en una aplicación con reconocimiento de accesibilidad, el control puede proporcionar la información accesible que sea necesaria.
En este ejemplo se muestra el uso de la enumeración AccessibleNavigation con el método Navigate. Para obtener el código completo del ejemplo, vea la información general de la clase AccessibleObject.
// Inner class ChartControlAccessibleObject represents accessible information associated with the ChartControl. // The ChartControlAccessibleObject is returned in the ChartControl.CreateAccessibilityInstance override. public class ChartControlAccessibleObject : ControlAccessibleObject { ChartControl chartControl; public ChartControlAccessibleObject(ChartControl ctrl) : base(ctrl) { chartControl = ctrl; } // Gets the role for the Chart. This is used by accessibility programs. public override AccessibleRole Role { get { return AccessibleRole.Chart; } } // Gets the state for the Chart. This is used by accessibility programs. public override AccessibleStates State { get { return AccessibleStates.ReadOnly; } } // The CurveLegend objects are "child" controls in terms of accessibility so // return the number of ChartLengend objects. public override int GetChildCount() { return chartControl.Legends.Length; } // Gets the Accessibility object of the child CurveLegend idetified by index. public override AccessibleObject GetChild(int index) { if (index >= 0 && index < chartControl.Legends.Length) { return chartControl.Legends[index].AccessibilityObject; } return null; } // Helper function that is used by the CurveLegend's accessibility object // to navigate between sibiling controls. Specifically, this function is used in // the CurveLegend.CurveLegendAccessibleObject.Navigate function. internal AccessibleObject NavigateFromChild(CurveLegend.CurveLegendAccessibleObject child, AccessibleNavigation navdir) { switch(navdir) { case AccessibleNavigation.Down: case AccessibleNavigation.Next: return GetChild(child.ID + 1); case AccessibleNavigation.Up: case AccessibleNavigation.Previous: return GetChild(child.ID - 1); } return null; } // Helper function that is used by the CurveLegend's accessibility object // to select a specific CurveLegend control. Specifically, this function is used // in the CurveLegend.CurveLegendAccessibleObject.Select function. internal void SelectChild(CurveLegend.CurveLegendAccessibleObject child, AccessibleSelection selection) { int childID = child.ID; // Determine which selection action should occur, based on the // AccessibleSelection value. if ((selection & AccessibleSelection.TakeSelection) != 0) { for(int i = 0; i < chartControl.Legends.Length; i++) { if (i == childID) { chartControl.Legends[i].Selected = true; } else { chartControl.Legends[i].Selected = false; } } // AccessibleSelection.AddSelection means that the CurveLegend will be selected. if ((selection & AccessibleSelection.AddSelection) != 0) { chartControl.Legends[childID].Selected = true; } // AccessibleSelection.AddSelection means that the CurveLegend will be unselected. if ((selection & AccessibleSelection.RemoveSelection) != 0) { chartControl.Legends[childID].Selected = false; } } } }
// Inner class ChartControlAccessibleObject represents accessible
// information associated with the ChartControl.
// The ChartControlAccessibleObject is returned in the
// ChartControl.CreateAccessibilityInstance override.
public static class ChartControlAccessibleObject
extends ControlAccessibleObject
{
private ChartControl chartControl;
public ChartControlAccessibleObject(ChartControl ctrl)
{
super(ctrl);
chartControl = ctrl;
} //ChartControlAccessibleObject
// Gets the role for the Chart. This is used by accessibility programs.
/** @property
*/
public AccessibleRole get_Role()
{
return AccessibleRole.Chart;
} //get_Role
// Gets the state for the Chart. This is used by accessibility programs.
/** @property
*/
public AccessibleStates get_State()
{
return AccessibleStates.ReadOnly;
} //get_State
// The CurveLegend objects are "child" controls in terms of
// accessibility so return the number of ChartLengend objects.
public int GetChildCount()
{
return chartControl.get_Legends().get_Length();
} //GetChildCount
// Gets the Accessibility object of the child CurveLegend
// idetified by index.
public AccessibleObject GetChild(int index)
{
if (index >= 0 && index < chartControl.get_Legends().get_Length()) {
return chartControl.get_Legends()[index].
get_AccessibilityObject();
}
return null;
} //GetChild
// Helper function that is used by the CurveLegend's accessibility
// object to navigate between sibiling controls.
// Specifically, this function is used in
// the CurveLegend.CurveLegendAccessibleObject.Navigate function.
AccessibleObject NavigateFromChild(
CurveLegend.CurveLegendAccessibleObject child,
AccessibleNavigation navDir)
{
if (navDir.Equals(AccessibleNavigation.Down)
|| navDir.Equals(AccessibleNavigation.Next)) {
return GetChild(child.get_ID() + 1);
}
else {
if (navDir.Equals(AccessibleNavigation.Up)
|| navDir.Equals(AccessibleNavigation.Previous)) {
return GetChild(child.get_ID() - 1);
}
}
return null;
} //NavigateFromChild
// Helper function that is used by the CurveLegend's accessibility
// object to select a specific CurveLegend control.
// Specifically, this function is used
// in the CurveLegend.CurveLegendAccessibleObject.Select function.
public void SelectChild(CurveLegend.CurveLegendAccessibleObject child,
AccessibleSelection selection)
{
int childID = child.get_ID();
// Determine which selection action should occur, based on the
// AccessibleSelection value.
if (Convert.ToInt32(selection & AccessibleSelection.TakeSelection)
!= 0) {
for (int i = 0; i < chartControl.get_Legends().get_Length();
i++) {
if (i == childID) {
((CurveLegend)chartControl.get_Legends().get_Item(i)).
set_Selected(true);
}
else {
((CurveLegend)chartControl.get_Legends().get_Item(i)).
set_Selected(false);
}
}
// AccessibleSelection.AddSelection means that the CurveLegend
// will be selected.
if (Convert.ToInt32(selection & AccessibleSelection.AddSelection)
!= 0) {
((CurveLegend)chartControl.get_Legends().get_Item(childID)).
set_Selected(true);
}
// AccessibleSelection.AddSelection means that the CurveLegend
// will be unselected.
if (Convert.ToInt32(selection &
AccessibleSelection.RemoveSelection) != 0) {
((CurveLegend)chartControl.get_Legends().get_Item(childID)).
set_Selected(false);
}
}
} //SelectChild
} //ChartControlAccessibleObject
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.