Control.QueryAccessibilityHelp 事件

定義

發生於 AccessibleObject 為協助工具應用程式提供說明時。Occurs when AccessibleObject is providing help to accessibility applications.

public:
 event System::Windows::Forms::QueryAccessibilityHelpEventHandler ^ QueryAccessibilityHelp;
public event System.Windows.Forms.QueryAccessibilityHelpEventHandler QueryAccessibilityHelp;
member this.QueryAccessibilityHelp : System.Windows.Forms.QueryAccessibilityHelpEventHandler 
Public Custom Event QueryAccessibilityHelp As QueryAccessibilityHelpEventHandler 

範例

下列程式碼範例示範如何建立可感知存取範圍的圖表控制項,使用 AccessibleObjectControl.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. 衍生自 ControlAccessibleObjectChartControlAccessibleObject 類別,會用於 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 方法,以傳回代表圖例每個部分之可存取訊號的 CurveLegendAccessibleObjectBecause 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.

這段程式碼摘錄示範如何處理 QueryAccessibilityHelp 事件。This code excerpt demonstrates handling the QueryAccessibilityHelp event. 如需完整的程式碼範例,請參閱 AccessibleObject 類別總覽。See the AccessibleObject class overview for the complete code example.

// Handles the QueryAccessibilityHelp event.
void ChartControl_QueryAccessibilityHelp( Object^ /*sender*/, System::Windows::Forms::QueryAccessibilityHelpEventArgs^ e )
{
   e->HelpString = "Displays chart data";
}
// Handles the QueryAccessibilityHelp event.
private void ChartControl_QueryAccessibilityHelp(object sender, 
                            System.Windows.Forms.QueryAccessibilityHelpEventArgs e)
{            
    e.HelpString = "Displays chart data";
}          
' Handle the QueryAccessibilityHelp event.
Private Sub ChartControl_QueryAccessibilityHelp(sender As Object, _
                   e As System.Windows.Forms.QueryAccessibilityHelpEventArgs) Handles MyBase.QueryAccessibilityHelp
    e.HelpString = "Displays chart data"
End Sub 

備註

您應該使用 HelpProvider 類別,讓使用者按下 F1 鍵,以叫用可存取物件的說明。You should use the HelpProvider class to enable users to invoke help on your accessible object by pressing the F1 key. 使用 HelpProvider 可提供您 QueryAccessibilityHelpEventArgs 中的完整資訊。Using the HelpProvider provides you with complete information in the QueryAccessibilityHelpEventArgs. 如需處理事件的詳細資訊,請參閱處理和引發事件For more information about handling events, see Handling and Raising Events.

適用於

另請參閱