Dieser Artikel wurde maschinell übersetzt. Wenn Sie die englische Version des Artikels anzeigen möchten, aktivieren Sie das Kontrollkästchen Englisch. Sie können den englischen Text auch in einem Popupfenster anzeigen, indem Sie den Mauszeiger über den Text bewegen.
Übersetzung
Englisch

Control.AccessibilityNotifyClients-Methode: (AccessibleEvents, Int32)

 

Veröffentlicht: Oktober 2016

Benachrichtigt die Clientanwendungen für die Barrierefreiheit über die angegebenen AccessibleEvents für das angegebene untergeordnete Steuerelement.

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

protected internal void AccessibilityNotifyClients(
	AccessibleEvents accEvent,
	int childID
)

Parameter

accEvent
Type: System.Windows.Forms.AccessibleEvents

Die AccessibleEvents-Enumeration, über die die Clientanwendungen für die Barrierefreiheit benachrichtigt werden sollen.

childID
Type: System.Int32

Das untergeordnete Control, das über das barrierefreie Ereignis benachrichtigt werden soll.

You must call the M:System.Windows.Forms.Control.ControlAccessibleObject.NotifyClients(System.Windows.Forms.AccessibleEvents) method for each T:System.Windows.Forms.AccessibleEvents the accessibility client applications are to be notified of. The M:System.Windows.Forms.Control.ControlAccessibleObject.NotifyClients(System.Windows.Forms.AccessibleEvents) method is typically called when a property is set or from within an event handler. For example, you might call the M:System.Windows.Forms.Control.ControlAccessibleObject.NotifyClients(System.Windows.Forms.AccessibleEvents) method and pass in an T:System.Windows.Forms.AccessibleEvents value of Hide from within the event handler for the E:System.Windows.Forms.Control.VisibleChanged event.

The following code example demonstrates the creation of an accessibility-aware chart control, using the T:System.Windows.Forms.AccessibleObject and T:System.Windows.Forms.Control.ControlAccessibleObject classes to expose accessible information. The control plots two curves along with a legend. The ChartControlAccessibleObject class, which derives from ControlAccessibleObject, is used in the M:System.Windows.Forms.Control.CreateAccessibilityInstance method to provide custom accessible information for the chart control. Since the chart legend is not an actual T:System.Windows.Forms.Control -based control, but instead is drawn by the chart control, it does not any built-in accessible information. Because of this, the ChartControlAccessibleObject class overrides the M:System.Windows.Forms.AccessibleObject.GetChild(System.Int32) method to return the CurveLegendAccessibleObject that represents accessible information for each part of the legend. When an accessible-aware application uses this control, the control can provide the necessary accessible information.

This code excerpt demonstrates calling the M:System.Windows.Forms.Control.AccessibilityNotifyClients(System.Windows.Forms.AccessibleEvents,System.Int32) method. See the T:System.Windows.Forms.AccessibleObject class overview for the complete code example.

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

.NET Framework
Verfügbar seit 1.1
Zurück zum Anfang
Anzeigen: