共用方式為


Shape.KeyUp 事件

發生於放開按鍵且焦點在圖形時。

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

語法

'宣告
<BrowsableAttribute(True)> _
Public Event KeyUp As KeyEventHandler
[BrowsableAttribute(true)]
public event KeyEventHandler KeyUp
[BrowsableAttribute(true)]
public:
 event KeyEventHandler^ KeyUp {
    void add (KeyEventHandler^ value);
    void remove (KeyEventHandler^ value);
}
[<BrowsableAttribute(true)>]
member KeyUp : IEvent<KeyEventHandler,
    KeyEventArgs>
JScript 不支援事件。

備註

主要事件發生順序如下:

KeyDown

KeyPress

KeyUp

若要處理鍵盤事件只能在表單層級並不會啟用接收鍵盤事件的圖形,設定Handled屬性在表單的KeyPress事件處理方法來true。

如需如何處理事件的詳細資訊,請參閱處理和引發事件

範例

下列範例會使用KeyUp事件搭配Help類別,以顯示快顯樣式協助使用者。

此範例中您需要OvalShape名 OvalShape1 為表單上的控制項。

Private Sub OvalShape1_KeyUp(
    ByVal sender As Object, 
    ByVal e As System.Windows.Forms.KeyEventArgs
  ) Handles OvalShape1.KeyUp

    ' Determine whether the key entered is the F1 key.  
    ' Display Help if it is. 
    If e.KeyCode = Keys.F1 Then 
        ' Display a pop-up Help message to assist the user.
        Help.ShowPopup(OvalShape1.Parent, 
          "This represents a router.", New Point(500, 500))
    End If 
End Sub
private void ovalShape1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
    // Determine whether the key entered is the F1 key.  
    // Display Help if it is. 
    if (e.KeyCode == Keys.F1)
    // Display a pop-up Help message to assist the user.
    {
        Help.ShowPopup(ovalShape1.Parent, "This represents a router.", 
            new Point(500, 500));
    }
}

.NET Framework 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

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

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

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