共用方式為


Shape.ModifierKeys 屬性

取得一個值。這個值會指示哪一個輔助按鍵 (Modifier Key) (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
static function get ModifierKeys () : Keys

屬性值

型別:System.Windows.Forms.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 命名空間

其他資源

HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)

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

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