共用方式為


Shape.MouseWheel 事件

發生於滑鼠滾輪移動且焦點在圖形時。

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

語法

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

備註

處理時MouseWheel事件,您應該遵循與滑鼠滾輪相關聯的使用者介面 (UI) 標準。 Delta屬性值表示已移動滑鼠滾輪的量。 加號或減號 120 累積的差異時,應該捲動 UI。 UI 捲動時,應邏輯程式敘述行所傳回的數目MouseWheelScrollLines達到每個差異值的屬性。 您也可以捲動更順利地使用小於 120 單位增量。 不過,比例應該保持不變,也就是MouseWheelScrollLines每 120 差異單位滾輪捲動的行。

滑鼠事件依下列順序發生:

MouseEnter

MouseMove

MouseHover / MouseDown / MouseWheel

MouseUp

MouseLeave

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

範例

下列範例示範如何使用MouseWheel捲動事件RectangleShape控制項。 此範例中您需要RectangleShape名 RectangleShape1 為表單上的控制項。

Private Sub RectangleShape1_MouseWheel(
    ByVal sender As Object, 
   ByVal e As System.Windows.Forms.MouseEventArgs
  ) Handles RectangleShape1.MouseWheel

    ' Move the shape vertically to correspond to the scrolling of the 
    ' mouse wheel. 
    Dim scale As Integer = e.Delta * 
      SystemInformation.MouseWheelScrollLines / 120
    RectangleShape1.Top = RectangleShape1.Top - scale
End Sub
        private void rectangleShape1_MouseWheel(object sender, 
            System.Windows.Forms.MouseEventArgs e)
        {
            // Move the shape vertically to correspond to the scrolling of the 
            // mouse wheel. 
            int scale = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
            rectangleShape1.Top = rectangleShape1.Top - scale;
        }

.NET Framework 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

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

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

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