Shape.Move イベント
更新 : 2007 年 11 月
図形が移動したときに発生します。
名前空間 : Microsoft.VisualBasic.PowerPacks
アセンブリ : Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)
構文
'宣言
<BrowsableAttribute(True)> _
Public Event Move As EventHandler
'使用
Dim instance As Shape
Dim handler As EventHandler
AddHandler instance.Move, handler
[BrowsableAttribute(true)]
public event EventHandler Move
[BrowsableAttribute(true)]
public:
event EventHandler^ Move {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
JScript では、イベントは使用できません。
解説
Move イベントは、図形の位置がコンテナを基準として変更されたときにのみ発生し、コンテナが移動したときには発生しません。
イベントの処理方法の詳細については、「イベントの利用」を参照してください。
例
イベント ハンドラの中で Move イベントに応答する方法を次の例に示します。この例では、OvalShape1 という名前の OvalShape コントロールおよび RectangleShape1 という名前の RectangleShape コントロールがフォーム上に配置されている必要があります。
Private Sub OvalShape1_Move(ByVal sender As Object, _
ByVal e As System.EventArgs) 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();
}
}
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。
参照
参照
Microsoft.VisualBasic.PowerPacks 名前空間
その他の技術情報
方法 : LineShape コントロールを使用して線を描画する (Visual Studio)
方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)