共用方式為


Shape.ModifierKeys 屬性

取得表示哪個輔助按鍵 (SHIFT、CTRL 和 ALT) 是處於按下狀態的值。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
<BrowsableAttribute(False)> _
Public Shared ReadOnly Property ModifierKeys As Keys
[BrowsableAttribute(false)]
public static Keys ModifierKeys { get; }
[BrowsableAttribute(false)]
public:
static property Keys ModifierKeys {
    Keys get ();
}
[<BrowsableAttribute(false)>]
static member ModifierKeys : Keys with get
static function get ModifierKeys () : Keys

屬性值

類型:Keys
Keys 值的位元 (Bitwise) 組合。預設為 None。

範例

按一下圖形時,按下 CTRL 鍵時,下列範例會隱藏圖形。 此範例中您需要RectangleShape名 RectangleShape1 為表單上。

Private Sub RectangleShape1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RectangleShape1.Click
    If Shape.ModifierKeys = Keys.Control Then 
        CType(sender, Shape).Hide()
    End If 
End Sub
private void rectangleShape1_Click(System.Object sender, System.EventArgs e)
{
    if (Shape.ModifierKeys == Keys.Control)
    {
        ((Shape)sender).Hide();
    }
}

.NET Framework 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)

Line 和 Shape 控制項簡介 (Visual Studio)