共用方式為


FlightStick.GetButtonLabel(FlightStickButtons) 方法

定義

擷取指定按鈕的按鈕標籤。

public:
 virtual GameControllerButtonLabel GetButtonLabel(FlightStickButtons button) = GetButtonLabel;
GameControllerButtonLabel GetButtonLabel(FlightStickButtons const& button);
public GameControllerButtonLabel GetButtonLabel(FlightStickButtons button);
function getButtonLabel(button)
Public Function GetButtonLabel (button As FlightStickButtons) As GameControllerButtonLabel

參數

button
FlightStickButtons

要擷取標籤的按鈕。

傳回

指定按鈕的標籤。 如果按鈕標籤空白,或控制器按鈕沒有已知的標籤,則會傳回 None

備註

下列範例會取得飛行杆上 FirePrimary 按鈕上的標籤,並根據標籤顯示圖示。

#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;

void ShowFlightStickFirePrimaryButtonIcon(FlightStick flightStick)
{
    GameControllerButtonLabel label =
        flightStick.GetButtonLabel(FlightStickButtons::FirePrimary);

    switch (label)
    {
        case (GameControllerButtonLabel::RightTrigger):
        {
            // Show the right trigger icon.
        }
        // ...
    }
}

適用於

另請參閱