Condividi tramite


AccessibleStates Enumerazione

Definizione

Specifica i valori che rappresentano i possibili stati per un oggetto accessibile.

Questa enumerazione supporta una combinazione bit per bit dei rispettivi valori dei membri.

public enum class AccessibleStates
[System.Flags]
public enum AccessibleStates
[<System.Flags>]
type AccessibleStates = 
Public Enum AccessibleStates
Ereditarietà
AccessibleStates
Attributi

Campi

Nome Valore Descrizione
None 0

Nessuno stato.

Unavailable 1

Oggetto non disponibile.

Selected 2

Oggetto selezionato.

Focused 4

Oggetto con lo stato attivo della tastiera.

Pressed 8

Oggetto premuto.

Checked 16

Oggetto con una casella di controllo selezionata.

Indeterminate 32

Casella di controllo a tre stati o pulsante della barra degli strumenti il cui stato è indeterminato. La casella di controllo non è selezionata né deselezionata e si trova nello stato terzo o misto.

Mixed 32

Casella di controllo a tre stati o pulsante della barra degli strumenti il cui stato è indeterminato. La casella di controllo non è selezionata né deselezionata e si trova nello stato terzo o misto.

ReadOnly 64

Oggetto di sola lettura.

HotTracked 128

L'oggetto rilevato dal mouse, ovvero l'aspetto è evidenziato per indicare che il puntatore del mouse si trova sopra di esso.

Default 256

Pulsante predefinito o voce di menu.

Expanded 512

Elementi figlio visualizzati dell'oggetto che sono elementi in una struttura struttura o struttura ad albero.

Collapsed 1024

Elementi figlio nascosti dell'oggetto che sono elementi in una struttura struttura o struttura ad albero.

Busy 2048

Controllo che non può accettare l'input nella condizione corrente.

Floating 4096

Oggetto che non è fisso al limite dell'oggetto padre e che non viene spostato automaticamente insieme all'elemento padre.

Marqueed 8192

Oggetto con scorrimento o spostamento di testo o grafica.

Animated 16384

Oggetto che cambia rapidamente o costantemente aspetto. La grafica animata occasionalmente, ma non sempre, deve essere definita come GraphicORAnimated. Questo stato non deve essere utilizzato per indicare che la posizione dell'oggetto sta cambiando.

Invisible 32768

Oggetto senza un'interfaccia utente visibile.

Offscreen 65536

Nessuna rappresentazione sullo schermo. Un oggetto audio o avviso avrà questo stato o una finestra nascosta che non viene mai resa visibile.

Sizeable 131072

Oggetto ridimensionabile.

Moveable 262144

Oggetto mobile.

SelfVoicing 524288

L'oggetto o l'elemento figlio può usare la sintesi vocale (TTS) per descriversi. Un aiuto per l'accessibilità basata sul riconoscimento vocale non deve annunciare informazioni quando un oggetto con questo stato ha lo stato attivo, perché l'oggetto annuncia automaticamente informazioni su se stesso.

Focusable 1048576

Oggetto nella finestra attiva che può ricevere lo stato attivo della tastiera.

Selectable 2097152

Oggetto che può accettare la selezione.

Linked 4194304

Oggetto collegato non selezionato in precedenza.

Traversed 8388608

Oggetto collegato selezionato in precedenza.

MultiSelectable 16777216

Oggetto che accetta più elementi selezionati.

ExtSelectable 33554432

Selezione modificata in modo che tutti gli oggetti tra l'ancoraggio di selezione, ovvero l'oggetto con lo stato attivo della tastiera, e questo oggetto assuma lo stato di selezione dell'oggetto di ancoraggio. Se l'oggetto di ancoraggio non è selezionato, gli oggetti vengono rimossi dalla selezione. Se l'oggetto di ancoraggio è selezionato, la selezione viene estesa per includere questo oggetto e tutti gli oggetti tra di essi. È possibile impostare lo stato di selezione combinando questo oggetto con AddSelection o RemoveSelection. Questo stato non modifica lo stato attivo o l'ancoraggio di selezione a meno che non sia combinato con TakeFocus.

AlertLow 67108864

Informazioni con priorità bassa che potrebbero non essere importanti per l'utente.

AlertMedium 134217728

Le informazioni importanti che non devono essere trasmesse immediatamente all'utente. Ad esempio, quando un indicatore a livello di batteria inizia a raggiungere un livello basso, potrebbe generare un avviso di livello medio. Le utilità di accesso cieco potrebbero quindi generare un suono per informare l'utente che sono disponibili informazioni importanti, senza interrompere effettivamente il lavoro dell'utente. Gli utenti possono quindi eseguire query sulle informazioni sull'avviso ogni volta che scelgono.

AlertHigh 268435456

Informazioni importanti che devono essere trasmesse immediatamente all'utente. Ad esempio, un indicatore a livello di batteria che raggiunge un basso livello critico passa a questo stato, nel qual caso un'utilità di accesso cieco annuncia immediatamente queste informazioni all'utente e un programma di ingrandimento dello schermo scorre lo schermo in modo che l'indicatore della batteria sia visualizzato. Questo stato è appropriato anche per qualsiasi richiesta o operazione che deve essere completata prima che l'utente possa continuare.

Protected 536870912

Controllo di modifica protetto da password.

Valid 1073741823

Oggetto valido. Questa proprietà è deprecata.

HasPopup 1073741824

L'oggetto visualizza un menu a comparsa o una finestra quando viene richiamato.

Esempio

Nell'esempio di codice seguente viene illustrata la creazione di un controllo grafico compatibile con l'accessibilità usando le AccessibleObject classi e Control.ControlAccessibleObject per esporre informazioni accessibili. Il controllo traccia due curve insieme a una legenda. La ChartControlAccessibleObject classe , che deriva da ControlAccessibleObject, viene utilizzata nel CreateAccessibilityInstance metodo per fornire informazioni accessibili personalizzate per il controllo grafico. Poiché la legenda del grafico non è un controllo effettivo basato su Control, ma viene invece disegnato dal controllo grafico, non contiene informazioni accessibili predefinite. Per questo motivo, la classe esegue l'override ChartControlAccessibleObject del GetChild metodo per restituire l'oggetto CurveLegendAccessibleObject che rappresenta informazioni accessibili per ogni parte della legenda. Quando un'applicazione con riconoscimento dell'accesso usa questo controllo, il controllo può fornire le informazioni accessibili necessarie.

Questo estratto di codice illustra l'utilizzo dell'enumerazione AccessibleStates con la State proprietà . Vedere la panoramica della AccessibleObject classe per l'esempio di codice completo.

// Inner class ChartControlAccessibleObject represents accessible information associated with the ChartControl.
// The ChartControlAccessibleObject is returned in the ChartControl::CreateAccessibilityInstance .
ref class ChartControlAccessibleObject: public ControlAccessibleObject
{
private:
   ChartControl^ chartControl;

public:
   ChartControlAccessibleObject( ChartControl^ ctrl )
      : ControlAccessibleObject( ctrl )
   {
      chartControl = ctrl;
   }


   property System::Windows::Forms::AccessibleRole Role 
   {

      // Gets the role for the Chart. This is used by accessibility programs.
      virtual System::Windows::Forms::AccessibleRole get() override
      {
         return ::AccessibleRole::Chart;
      }

   }

   property AccessibleStates State 
   {

      // Gets the state for the Chart. This is used by accessibility programs.
      virtual AccessibleStates get() override
      {
         return AccessibleStates::ReadOnly;
      }

   }

   // The CurveLegend objects are "child" controls in terms of accessibility so
   // return the number of ChartLengend objects.
   virtual int GetChildCount() override
   {
      return chartControl->Legends->Length;
   }


   // Gets the Accessibility object of the child CurveLegend idetified by index.
   virtual AccessibleObject^ GetChild( int index ) override
   {
      if ( index >= 0 && index < chartControl->Legends->Length )
      {
         return chartControl->Legends[ index ]->AccessibilityObject;
      }

      return nullptr;
   }


internal:

   // 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 )
   {
      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 nullptr;
   }


   // 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.
   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) != (AccessibleSelection)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) != (AccessibleSelection)0 )
         {
            chartControl->Legends[ childID ]->Selected = true;
         }
         
         // AccessibleSelection->AddSelection means that the CurveLegend will be unselected.
         if ( (selection & AccessibleSelection::RemoveSelection) != (AccessibleSelection)0 )
         {
            chartControl->Legends[ childID ]->Selected = false;
         }
      }
   }

};

// class ChartControlAccessibleObject
// 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 Class ChartControlAccessibleObject
    Inherits Control.ControlAccessibleObject

    Private chartControl As ChartControl
    
    Public Sub New(ctrl As ChartControl)
        MyBase.New(ctrl)
        chartControl = ctrl
    End Sub
    
    ' Get the role for the Chart. This is used by accessibility programs.            
    Public Overrides ReadOnly Property Role() As AccessibleRole
        Get
            Return System.Windows.Forms.AccessibleRole.Chart
        End Get
    End Property
    
    ' Get the state for the Chart. This is used by accessibility programs.            
    Public Overrides ReadOnly Property State() As AccessibleStates
        Get
            Return AccessibleStates.ReadOnly
        End Get
    End Property                        
    
    ' The CurveLegend objects are "child" controls in terms of accessibility so 
    ' return the number of ChartLengend objects.            
    Public Overrides Function GetChildCount() As Integer
        Return chartControl.Legends.Length
    End Function 
    
    ' Get the Accessibility object of the child CurveLegend idetified by index.
    Public Overrides Function GetChild(index As Integer) As AccessibleObject
        If index >= 0 And index < chartControl.Legends.Length Then
            Return chartControl.Legends(index).AccessibilityObject
        End If
        Return Nothing
    End Function 
    
    ' 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.
    Friend Function NavigateFromChild(child As CurveLegend.CurveLegendAccessibleObject, _
                                    navdir As AccessibleNavigation) As AccessibleObject
        Select Case navdir
            Case AccessibleNavigation.Down, AccessibleNavigation.Next
                    Return GetChild(child.ID + 1)
            
            Case AccessibleNavigation.Up, AccessibleNavigation.Previous
                    Return GetChild(child.ID - 1)
        End Select
        Return Nothing
    End Function            

    ' 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.            
    Friend Sub SelectChild(child As CurveLegend.CurveLegendAccessibleObject, selection As AccessibleSelection)
        Dim childID As Integer = child.ID
        
        ' Determine which selection action should occur, based on the
        ' AccessibleSelection value.
        If (selection And AccessibleSelection.TakeSelection) <> 0 Then
            Dim i As Integer
            For i = 0 To chartControl.Legends.Length - 1
                If i = childID Then
                    chartControl.Legends(i).Selected = True
                Else
                    chartControl.Legends(i).Selected = False
                End If
            Next i
            
            ' AccessibleSelection.AddSelection means that the CurveLegend will be selected.
            If (selection And AccessibleSelection.AddSelection) <> 0 Then
                chartControl.Legends(childID).Selected = True
            End If

            ' AccessibleSelection.AddSelection means that the CurveLegend will be unselected.                    
            If (selection And AccessibleSelection.RemoveSelection) <> 0 Then
                chartControl.Legends(childID).Selected = False
            End If
        End If
    End Sub
End Class

Commenti

Un oggetto accessibile può essere associato a uno o più di questi stati.

Si applica a

Vedi anche