Control.AccessibilityNotifyClients 方法
定義
將 AccessibleEvents 告知協助工具用戶端應用程式。Notifies the accessibility client applications of AccessibleEvents.
多載
AccessibilityNotifyClients(AccessibleEvents, Int32) |
將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control. |
AccessibilityNotifyClients(AccessibleEvents, Int32, Int32) |
將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control . |
AccessibilityNotifyClients(AccessibleEvents, Int32)
將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control.
protected:
void AccessibilityNotifyClients(System::Windows::Forms::AccessibleEvents accEvent, int childID);
protected 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)
參數
- accEvent
- AccessibleEvents
要通知協助工具用戶端應用程式的 AccessibleEvents。The AccessibleEvents to notify the accessibility client applications of.
範例
下列程式碼範例示範如何建立可感知存取範圍的圖表控制項,使用 AccessibleObject 和 Control.ControlAccessibleObject 類別來公開可存取的資訊。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. 衍生自 ControlAccessibleObject
的 ChartControlAccessibleObject
類別,會用於 CreateAccessibilityInstance 方法中,以便為 chart 控制項提供自訂的可存取訊號。The ChartControlAccessibleObject
class, which derives from ControlAccessibleObject
, is used in the CreateAccessibilityInstance method to provide custom accessible information for the chart control. 由於圖表圖例不是實際的 Control 型控制項,而是由 chart 控制項繪製,因此不會有任何內建的可存取訊號。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. 因此,ChartControlAccessibleObject
類別會覆寫 GetChild 方法,以傳回代表圖例每個部分之可存取訊號的 CurveLegendAccessibleObject
。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.
這段程式碼摘錄會示範如何呼叫 AccessibilityNotifyClients 方法。This code excerpt demonstrates calling the AccessibilityNotifyClients method. 如需完整的程式碼範例,請參閱 AccessibleObject 類別總覽。See the AccessibleObject class overview for the complete code example.
// 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 方法,協助工具用戶端應用程式將會收到通知。You must call the Control.ControlAccessibleObject.NotifyClients method for each AccessibleEvents the accessibility client applications are to be notified of. 當屬性是在事件處理常式中設定或時,通常會呼叫 NotifyClients 方法。The NotifyClients method is typically called when a property is set or from within an event handler. 例如,您可能會呼叫 NotifyClients 方法,並從 Control.VisibleChanged 事件的事件處理常式內傳入 AccessibleEvents 的 Hide
值。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.
另請參閱
AccessibilityNotifyClients(AccessibleEvents, Int32, Int32)
將指定子控制項的指定 AccessibleEvents 告知協助工具用戶端應用程式。Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control .
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。The AccessibleEvents to notify the accessibility client applications of.
- objectID
- Int32
AccessibleObject 的識別項。The identifier of the AccessibleObject.