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.
        }
        // ...
    }
}

适用于

另请参阅