IKeyboardInputSink.TranslateAccelerator(MSG, ModifierKeys) IKeyboardInputSink.TranslateAccelerator(MSG, ModifierKeys) IKeyboardInputSink.TranslateAccelerator(MSG, ModifierKeys) IKeyboardInputSink.TranslateAccelerator(MSG, ModifierKeys) Method

定義

在 Keydown 訊息層級處理鍵盤輸入。Processes keyboard input at the keydown message level.

public:
 bool TranslateAccelerator(System::Windows::Interop::MSG % msg, System::Windows::Input::ModifierKeys modifiers);
[System.Security.SecurityCritical]
public bool TranslateAccelerator (ref System.Windows.Interop.MSG msg, System.Windows.Input.ModifierKeys modifiers);
abstract member TranslateAccelerator : MSG * System.Windows.Input.ModifierKeys -> bool
Public Function TranslateAccelerator (ByRef msg As MSG, modifiers As ModifierKeys) As Boolean

參數

msg
MSG MSG MSG MSG

訊息及相關聯資料。The message and associated data. 請勿修改這個結構。Do not modify this structure. 參考僅基於效能考量而傳送它。It is passed by reference for performance reasons only.

modifiers
ModifierKeys ModifierKeys ModifierKeys ModifierKeys

輔助按鍵 (Modifier Key)。Modifier keys.

傳回

如果訊息由方法實作處理則為 true,否則為 falsetrue if the message was handled by the method implementation; otherwise, false.

備註

訊息必須是 WM_KEYDOWN 或 WM_SYSKEYDOWN。The message must either be WM_KEYDOWN or WM_SYSKEYDOWN.

如果元件無法處理輸入翻譯,而且具有可能具有翻譯的子元件,通常會在傳回結果之前TranslateAccelerator ,在子元件上呼叫具有目前焦點的方法。If the component is unable to handle the input translations and has child components that might have translations, it typically calls TranslateAccelerator method on the child component that holds the current focus before returning a result.

如果無法立即處理訊息,您可以視需要從TranslateAccelerator執行中重新分派它, false然後傳回。If the message cannot be handled immediately, you can re-dispatch it from within the TranslateAccelerator implementation if necessary, and then return false.

翻譯快速鍵的主要案例是處理 VK_TAB 的 keydown 訊息,並決定是否要在元件內設定焦點、呼叫TabInto子元件,或在父網站上呼叫OnNoMoreTabStops ,因為索引標籤序列已到達開始或結束界限。A primary scenario for translating accelerator keys is handling the VK_TAB keydown message and determining whether to set focus within the component, to call TabInto to a child component, or to call OnNoMoreTabStops on the parent site because the tab sequence has reached the beginning or end bounds. 某些元件可能會選擇不以這種方式處理 tab 鍵。Certain components may choose to not handle the tab key in this fashion.

適用於

另請參閱