共用方式為


MouseEventArgs.MiddleButton 屬性

定義

取得滑鼠中鍵的目前狀態。

public:
 property System::Windows::Input::MouseButtonState MiddleButton { System::Windows::Input::MouseButtonState get(); };
public System.Windows.Input.MouseButtonState MiddleButton { get; }
member this.MiddleButton : System.Windows.Input.MouseButtonState
Public ReadOnly Property MiddleButton As MouseButtonState

屬性值

滑鼠中鍵的目前狀態,可能是 PressedReleased。 沒有任何預設值。

範例

如果 屬性的狀態 MiddleButtonPressed,下列範例會列印訊息。

if (e.MiddleButton == MouseButtonState.Pressed)
{

    MessageBox.Show("The Middle Mouse Button is pressed");
}
If e.MiddleButton = MouseButtonState.Pressed Then

    MessageBox.Show("The Middle Mouse Button is pressed")
End If

備註

類別 Mouse 提供用於判斷滑鼠狀態的其他屬性和方法。

適用於