共用方式為


Shape.Move 事件

發生於圖形移動時。

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

語法

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

備註

Move只當圖形的位置變更關於其容器,只有在移動容器時不發生的事件。

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

範例

下列範例顯示如何回應Move事件處理常式中的事件。 此範例中您需要OvalShape名為 OvalShape1 控制項和RectangleShape名 RectangleShape1 為表單上的控制項。

Private Sub OvalShape1_Move() Handles OvalShape1.Move
    Dim rect As New Rectangle
    ' Get the bounding rectangle for the rectangle shape.
    rect = RectangleShape1.DisplayRectangle
    ' Determine whether the bounding rectangles overlap. 
    If rect.IntersectsWith(OvalShape1.DisplayRectangle) Then 
        ' Bring the oval shape to the front.
        OvalShape1.BringToFront()
    End If 
End Sub
private void ovalShape1_Move(object sender, System.EventArgs e)
{
    Rectangle rect = new Rectangle();
    // Get the bounding rectangle for the rectangle shape.
    rect = rectangleShape1.DisplayRectangle;
    // Determine whether the bounding rectangles overlap. 
    if (rect.IntersectsWith(ovalShape1.DisplayRectangle))
    // Bring the oval shape to the front.
    {
        ovalShape1.BringToFront();
    }
}

.NET Framework 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

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

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

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