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)

'Declaration
Protected Friend Sub AccessibilityNotifyClients ( _
	accEvent As AccessibleEvents, _
	childID As Integer _
)

Parameters

accEvent
Type: System.Windows.Forms.AccessibleEvents

The AccessibleEvents to notify the accessibility client applications of.

childID
Type: System.Int32

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

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft