Cet article a fait l’objet d’une traduction automatique. Pour afficher l’article en anglais, activez la case d’option Anglais. Vous pouvez également afficher le texte anglais dans une fenêtre contextuelle en faisant glisser le pointeur de la souris sur le texte traduit.
Traduction
Anglais

Control.AccessibilityNotifyClients méthode (AccessibleEvents, Int32)

 

Date de publication : novembre 2016

Avertit les applications clientes d'accessibilité des AccessibleEvents spécifiés pour le contrôle enfant spécifié.

Espace de noms:   System.Windows.Forms
Assembly:  System.Windows.Forms (dans System.Windows.Forms.dll)

protected internal void AccessibilityNotifyClients(
	AccessibleEvents accEvent,
	int childID
)

Paramètres

accEvent
Type: System.Windows.Forms.AccessibleEvents

AccessibleEvents devant être notifié aux applications clientes d'accessibilité.

childID
Type: System.Int32

Control enfant à avertir de l'événement accessible.

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
Disponible depuis 1.1
Retour au début
Afficher: