Export (0) Print
Expand All

Control.AccessibilityNotifyClients Method (AccessibleEvents, Int32)

Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

protected internal void AccessibilityNotifyClients (
	AccessibleEvents accEvent,
	int childID
)
protected void AccessibilityNotifyClients (
	AccessibleEvents accEvent, 
	int childID
)
protected internal function AccessibilityNotifyClients (
	accEvent : AccessibleEvents, 
	childID : int
)
Not applicable.

Parameters

accEvent

The AccessibleEvents to notify the accessibility client applications of.

childID

The child Control to notify of the accessible event.

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

The following code example demonstrates the creation of an accessibility-aware chart control, using the AccessibleObject and 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 CreateAccessibilityInstance method to provide custom accessible information for the chart control. Since the chart legend is not an actual 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 GetChild 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 AccessibilityNotifyClients method. See the 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);
        }
    }
}

// Gets or sets the location for the curve legend.
/** @property 
 */
public Point get_Location()
{
    return location;
} //get_Location

/** @property 
 */
public void set_Location(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, 
        ((CurveLegendAccessibleObject)get_AccessibilityObject()).
        get_ID());
} //set_Location

// Gets or sets the Name for the curve legend.
/** @property 
 */
public String get_Name()
{
    return name;
} //get_Name

/** @property 
 */
public void set_Name(String value)
{
    if (!name.Equals(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)get_AccessibilityObject()).
            get_ID());
    }
} //set_Name

// Gets or sets the Selected state for the curve legend.
/** @property 
 */
public boolean get_Selected()
{
    return selected;
} //get_Selected

/** @property 
 */
public void set_Selected(boolean 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, 
            ((CurveLegendAccessibleObject)get_AccessibilityObject()).
            get_ID());
    }
} //set_Selected

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft