共用方式為


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 命名空間

其他資源

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

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

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