SimpleShape.LocationChanged 事件
發生於當Location圖形的屬性變更時。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
<BrowsableAttribute(True)> _
Public Event LocationChanged As EventHandler
[BrowsableAttribute(true)]
public event EventHandler LocationChanged
[BrowsableAttribute(true)]
public:
event EventHandler^ LocationChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
[<BrowsableAttribute(true)>]
member LocationChanged : IEvent<EventHandler,
EventArgs>
JScript 不支援事件。
備註
如果程式設計方式的修改或使用者互動變更了 Location 屬性時,就會引發這個事件。
如需如何處理事件的詳細資訊,請參閱使用事件。
範例
下列範例顯示如何在事件處理常式中回應 LocationChanged 事件。這個範例需要有兩個RectangleShape控制項的表單上命名為 RectangleShape1 和 RectangleShape2。
Private Sub RectangleShape1_LocationChanged(
) Handles RectangleShape1.LocationChanged
' If the second rectangle intersects with the first, move it.
If RectangleShape1.ClientRectangle.IntersectsWith(
RectangleShape2.ClientRectangle) Then
RectangleShape2.Location = New Point(RectangleShape1.Right,
RectangleShape1.Bottom)
End If
End Sub
private void rectangleShape1_LocationChanged(object sender, System.EventArgs e)
{
// If the second rectangle intersects with the first, move it.
if (rectangleShape1.ClientRectangle.IntersectsWith(rectangleShape2.ClientRectangle))
{
rectangleShape2.Location = new Point(rectangleShape1.Right,
rectangleShape1.Bottom);
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)
HOW TO:使用 LineShape 控制項繪製線條 (Visual Studio)
HOW TO:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)