Bagikan melalui


AccessibleStates Enum

Definisi

Menentukan nilai yang mewakili kemungkinan status untuk objek yang dapat diakses.

Enumerasi ini mendukung kombinasi bitwise dari nilai yang termasuk di dalamnya.

public enum class AccessibleStates
[System.Flags]
public enum AccessibleStates
[<System.Flags>]
type AccessibleStates = 
Public Enum AccessibleStates
Warisan
AccessibleStates
Atribut

Bidang

Nama Nilai Deskripsi
None 0

Tidak ada status.

Unavailable 1

Objek tidak tersedia.

Selected 2

Objek yang dipilih.

Focused 4

Objek dengan fokus keyboard.

Pressed 8

Objek yang ditekan.

Checked 16

Objek dengan kotak centang yang dipilih.

Indeterminate 32

Kotak centang tiga status atau tombol toolbar yang statusnya tidak ditentukan. Kotak centang tidak dicentang atau tidak dicentang, dan berada dalam status ketiga atau campuran.

Mixed 32

Kotak centang tiga status atau tombol toolbar yang statusnya tidak ditentukan. Kotak centang tidak dicentang atau tidak dicentang, dan berada dalam status ketiga atau campuran.

ReadOnly 64

Objek baca-saja.

HotTracked 128

Objek dilacak panas oleh mouse, yang berarti penampilannya disorot untuk menunjukkan penunjuk mouse terletak di atasnya.

Default 256

Tombol default atau item menu.

Expanded 512

Turunan objek yang ditampilkan yang merupakan item dalam struktur kerangka atau pohon.

Collapsed 1024

Anak-anak tersembunyi dari objek yang merupakan item dalam struktur kerangka atau pohon.

Busy 2048

Kontrol yang tidak dapat menerima input dalam kondisinya saat ini.

Floating 4096

Objek yang tidak diperbaiki ke batas objek induknya dan yang tidak bergerak secara otomatis bersama dengan induk.

Marqueed 8192

Objek dengan menggulir atau memindahkan teks atau grafik.

Animated 16384

Objek yang cepat atau terus berubah tampilan. Grafik yang kadang-kadang dianimasikan, tetapi tidak selalu, harus didefinisikan sebagai GraphicORAnimated. Status ini tidak boleh digunakan untuk menunjukkan bahwa lokasi objek berubah.

Invisible 32768

Objek tanpa antarmuka pengguna yang terlihat.

Offscreen 65536

Tidak ada representasi di layar. Objek suara atau pemberitahuan akan memiliki status ini, atau jendela tersembunyi yang tidak pernah dibuat terlihat.

Sizeable 131072

Objek yang dapat diukur.

Moveable 262144

Sebuah objek movable.

SelfVoicing 524288

Objek atau anak dapat menggunakan teks ke ucapan (TTS) untuk menggambarkan dirinya sendiri. Bantuan aksesibilitas berbasis ucapan tidak boleh mengumumkan informasi ketika objek dengan status ini memiliki fokus, karena objek secara otomatis mengumumkan informasi tentang dirinya sendiri.

Focusable 1048576

Objek pada jendela aktif yang dapat menerima fokus keyboard.

Selectable 2097152

Objek yang dapat menerima pilihan.

Linked 4194304

Objek tertaut yang belum dipilih sebelumnya.

Traversed 8388608

Objek tertaut yang sebelumnya telah dipilih.

MultiSelectable 16777216

Objek yang menerima beberapa item terpilih.

ExtSelectable 33554432

Pilihan yang diubah sedih sehingga semua objek antara jangkar pilihan, yang merupakan objek dengan fokus keyboard, dan objek ini mengambil status pilihan objek jangkar. Jika objek jangkar tidak dipilih, objek akan dihapus dari pilihan. Jika objek jangkar dipilih, pilihan diperluas untuk menyertakan objek ini dan semua objek di antaranya. Anda dapat mengatur status pilihan dengan menggabungkan ini dengan AddSelection atau RemoveSelection. Status ini tidak mengubah fokus atau jangkar pilihan kecuali dikombinasikan dengan TakeFocus.

AlertLow 67108864

Informasi berprioritas rendah yang mungkin tidak penting untuk pengguna.

AlertMedium 134217728

Informasi penting yang tidak perlu segera disampaikan kepada pengguna. Misalnya, ketika indikator tingkat baterai mulai mencapai tingkat rendah, itu dapat menghasilkan pemberitahuan tingkat menengah. Utilitas akses buta kemudian dapat menghasilkan suara untuk memberi tahu pengguna bahwa informasi penting tersedia, tanpa benar-benar mengganggu pekerjaan pengguna. Pengguna kemudian dapat mengkueri informasi pemberitahuan kapan saja mereka memilih.

AlertHigh 268435456

Informasi penting yang harus segera disampaikan kepada pengguna. Misalnya, indikator tingkat baterai yang mencapai tingkat rendah kritis akan beralih ke keadaan ini, dalam hal ini, utilitas akses buta akan segera mengumumkan informasi ini kepada pengguna, dan program pembesaran layar akan menggulir layar sehingga indikator baterai terlihat. Status ini juga sesuai untuk perintah atau operasi apa pun yang harus diselesaikan sebelum pengguna dapat melanjutkan.

Protected 536870912

Kontrol edit yang dilindungi kata sandi.

Valid 1073741823

Objek yang valid. Properti ini tidak digunakan lagi.

HasPopup 1073741824

Objek menampilkan menu pop-up atau jendela saat dipanggil.

Contoh

Contoh kode berikut menunjukkan pembuatan kontrol bagan sadar aksesibilitas, menggunakan AccessibleObject kelas dan Control.ControlAccessibleObject untuk mengekspos informasi yang dapat diakses. Kontrol memplot dua kurva bersama dengan legenda. Kelas ChartControlAccessibleObject , yang berasal dari ControlAccessibleObject, digunakan dalam CreateAccessibilityInstance metode untuk memberikan informasi yang dapat diakses kustom untuk kontrol bagan. Karena legenda bagan bukan kontrol aktual berdasarkan Control, tetapi sebaliknya digambar oleh kontrol bagan, legenda bagan tidak berisi informasi bawaan yang dapat diakses. Karena itu, ChartControlAccessibleObject kelas mengambil alih GetChild metode untuk mengembalikan CurveLegendAccessibleObject yang mewakili informasi yang dapat diakses untuk setiap bagian legenda. Ketika aplikasi yang mudah diakses menggunakan kontrol ini, kontrol dapat memberikan informasi yang dapat diakses yang diperlukan.

Kutipan kode ini menunjukkan penggunaan AccessibleStates enumerasi dengan State properti . AccessibleObject Lihat gambaran umum kelas untuk contoh kode lengkap.

// 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

Keterangan

Objek yang dapat diakses dapat dikaitkan dengan satu atau beberapa status ini.

Berlaku untuk

Lihat juga