Control.AccessibilityNotifyClients 方法

定義

AccessibleEvents 告知協助工具用戶端應用程式。

多載

AccessibilityNotifyClients(AccessibleEvents, Int32)

將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。

AccessibilityNotifyClients(AccessibleEvents, Int32, Int32)

將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。

AccessibilityNotifyClients(AccessibleEvents, Int32)

將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。

protected:
 void AccessibilityNotifyClients(System::Windows::Forms::AccessibleEvents accEvent, int childID);
protected public:
 void AccessibilityNotifyClients(System::Windows::Forms::AccessibleEvents accEvent, int childID);
protected void AccessibilityNotifyClients (System.Windows.Forms.AccessibleEvents accEvent, int childID);
protected internal void AccessibilityNotifyClients (System.Windows.Forms.AccessibleEvents accEvent, int childID);
member this.AccessibilityNotifyClients : System.Windows.Forms.AccessibleEvents * int -> unit
Protected Sub AccessibilityNotifyClients (accEvent As AccessibleEvents, childID As Integer)
Protected Friend Sub AccessibilityNotifyClients (accEvent As AccessibleEvents, childID As Integer)

參數

accEvent
AccessibleEvents

要通知協助工具用戶端應用程式的 AccessibleEvents

childID
Int32

要通知協助工具事件的子 Control

範例

下列程式碼範例示範如何使用 AccessibleObjectControl.ControlAccessibleObject 類別來公開無障礙資訊,建立協助工具感知圖表控制項。 控制項會繪製兩條曲線以及圖例。 衍生 ChartControlAccessibleObjectControlAccessibleObject 的 類別用於 方法中 CreateAccessibilityInstance ,以提供圖表控制項的自訂可存取訊號。 由於圖表圖例不是實際的 Control 控制項,而是由圖表控制項繪製,因此它不會有任何內建的可存取訊號。 因此,類別會 ChartControlAccessibleObjectGetChild 覆寫 方法,以傳回 CurveLegendAccessibleObject ,代表圖例每個部分的可存取訊號。 當可存取感知應用程式使用此控制項時,控制項可以提供必要的可存取訊號。

此程式碼摘錄示範如何呼叫 AccessibilityNotifyClients 方法。 如需完整的程式碼範例, AccessibleObject 請參閱 類別概觀。

   // Gets or sets the location for the curve legend.
   Point get()
   {
      return location;
   }

   void set( Point value )
   {
      location = value;
      chart->Invalidate();
      
      // Notifies the chart of the location change. This is used for
      // the accessibility information. AccessibleEvents::LocationChange
      // tells the chart the reason for the notification.
      chart->AccessibilityNotifyClients( AccessibleEvents::LocationChange, (dynamic_cast<CurveLegendAccessibleObject^>(AccessibilityObject))->ID );
   }

}

property String^ Name 
{

   // Gets or sets the Name for the curve legend.
   String^ get()
   {
      return name;
   }

   void set( String^ value )
   {
      if ( name != value )
      {
         name = value;
         chart->Invalidate();
         
         // Notifies the chart of the name change. This is used for
         // the accessibility information. AccessibleEvents::NameChange
         // tells the chart the reason for the notification.
         chart->AccessibilityNotifyClients( AccessibleEvents::NameChange, (dynamic_cast<CurveLegendAccessibleObject^>(AccessibilityObject))->ID );
      }
   }

}

property bool Selected 
{

   // Gets or sets the Selected state for the curve legend.
   bool get()
   {
      return selected;
   }

   void set( bool value )
   {
      if ( selected != value )
      {
         selected = value;
         chart->Invalidate();
         
         // Notifies the chart of the selection value change. This is used for
         // the accessibility information. The AccessibleEvents value depends upon
         // if the selection is true (AccessibleEvents::SelectionAdd) or
         // false (AccessibleEvents::SelectionRemove).
         chart->AccessibilityNotifyClients( selected ? AccessibleEvents::SelectionAdd : AccessibleEvents::SelectionRemove, (dynamic_cast<CurveLegendAccessibleObject^>(AccessibilityObject))->ID );
      }
   }
    // Gets or sets the location for the curve legend.
    public Point Location
    {   
        get {
            return location;
        }
        set {
            location = value;
            chart.Invalidate();

            // Notifies the chart of the location change. This is used for
            // the accessibility information. AccessibleEvents.LocationChange
            // tells the chart the reason for the notification.

            chart.AccessibilityNotifyClients(AccessibleEvents.LocationChange, 
                ((CurveLegendAccessibleObject)AccessibilityObject).ID);
        }
    }            

    // Gets or sets the Name for the curve legend.
    public string Name
    {   
        get {
            return name;
        }
        set {
            if (name != value) 
            {
                name = value;
                chart.Invalidate();

                // Notifies the chart of the name change. This is used for
                // the accessibility information. AccessibleEvents.NameChange
                // tells the chart the reason for the notification.

                chart.AccessibilityNotifyClients(AccessibleEvents.NameChange, 
                    ((CurveLegendAccessibleObject)AccessibilityObject).ID);
            }
        }
    }

    // Gets or sets the Selected state for the curve legend.
    public bool Selected
    {   
        get {
            return selected;
        }
        set {
            if (selected != value) 
            {
                selected = value;
                chart.Invalidate();

                // Notifies the chart of the selection value change. This is used for
                // the accessibility information. The AccessibleEvents value depends upon
                // if the selection is true (AccessibleEvents.SelectionAdd) or 
                // false (AccessibleEvents.SelectionRemove).
                chart.AccessibilityNotifyClients(
                    selected ? AccessibleEvents.SelectionAdd : AccessibleEvents.SelectionRemove, 
                    ((CurveLegendAccessibleObject)AccessibilityObject).ID);
            }
        }
    }
' Gets or sets the location for the curve legend.            
Public Property Location() As Point
    Get
        Return m_location
    End Get
    Set
        m_location = value
        chart.Invalidate()

        ' Notifies the chart of the location change. This is used for
        ' the accessibility information. AccessibleEvents.LocationChange
        ' tells the chart the reason for the notification.
        chart.ExposeAccessibilityNotifyClients(AccessibleEvents.LocationChange, _
                CType(AccessibilityObject, CurveLegendAccessibleObject).ID)
    End Set
End Property

' Gets or sets the Name for the curve legend.            
Public Property Name() As String
    Get
        Return m_name
    End Get
    Set
        If m_name <> value Then
            m_name = value
            chart.Invalidate()

            ' Notifies the chart of the name change. This is used for
            ' the accessibility information. AccessibleEvents.NameChange
            ' tells the chart the reason for the notification. 
            chart.ExposeAccessibilityNotifyClients(AccessibleEvents.NameChange, _
                    CType(AccessibilityObject, CurveLegendAccessibleObject).ID)
        End If
    End Set
End Property

' Gets or sets the Selected state for the curve legend.            
Public Property Selected() As Boolean
    Get
        Return m_selected
    End Get
    Set
        If m_selected <> value Then
            m_selected = value
            chart.Invalidate()

            ' Notifies the chart of the selection value change. This is used for
            ' the accessibility information. The AccessibleEvents value varies
            ' on whether the selection is true (AccessibleEvents.SelectionAdd) or 
            ' false (AccessibleEvents.SelectionRemove). 
            If m_selected Then
                chart.ExposeAccessibilityNotifyClients(AccessibleEvents.SelectionAdd, _
                        CType(AccessibilityObject, CurveLegendAccessibleObject).ID) 
            Else
                chart.ExposeAccessibilityNotifyClients(AccessibleEvents.SelectionRemove, _
                        CType(AccessibilityObject, CurveLegendAccessibleObject).ID) 
            End If
        End If
    End Set
End Property

備註

您必須針對每個 AccessibleEvents 協助工具用戶端應用程式呼叫 Control.ControlAccessibleObject.NotifyClients 方法,才能收到通知。 NotifyClients當屬性設定或從事件處理常式內設定或從中時,通常會呼叫 方法。 例如,您可以呼叫 方法, NotifyClients 並從 事件的事件處理常式 Control.VisibleChanged 內傳入 AccessibleEvents 的值 Hide

另請參閱

適用於

AccessibilityNotifyClients(AccessibleEvents, Int32, Int32)

將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。

protected:
 void AccessibilityNotifyClients(System::Windows::Forms::AccessibleEvents accEvent, int objectID, int childID);
protected void AccessibilityNotifyClients (System.Windows.Forms.AccessibleEvents accEvent, int objectID, int childID);
member this.AccessibilityNotifyClients : System.Windows.Forms.AccessibleEvents * int * int -> unit
Protected Sub AccessibilityNotifyClients (accEvent As AccessibleEvents, objectID As Integer, childID As Integer)

參數

accEvent
AccessibleEvents

要通知協助工具用戶端應用程式的 AccessibleEvents

objectID
Int32

AccessibleObject 的識別碼。

childID
Int32

要通知協助工具事件的子 Control

適用於