Control.QueryAccessibilityHelp Control.QueryAccessibilityHelp Control.QueryAccessibilityHelp Control.QueryAccessibilityHelp Event

定義

發生於 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. ChartControlAccessibleObject類別,衍生自ControlAccessibleObject,會在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-為基礎的控制,但改為繪製它不會由圖表控制項中,沒有任何內建的可存取資訊。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.

此程式碼摘錄會示範如何處理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中的完整資訊為您提供QueryAccessibilityHelpEventArgsUsing the HelpProvider provides you with complete information in the QueryAccessibilityHelpEventArgs. 如需有關如何處理事件的詳細資訊,請參閱 < 處理和引發事件For more information about handling events, see Handling and Raising Events.

適用於

另請參閱