ShapeContainer.GetChildAtPoint 方法 (Point)
取得位於指定座標處的圖案。
命名空間: Microsoft.VisualBasic.PowerPacks
組件: Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
語法
'宣告
Public Function GetChildAtPoint ( _
point As Point _
) As Shape
public Shape GetChildAtPoint(
Point point
)
public:
Shape^ GetChildAtPoint(
Point point
)
member GetChildAtPoint :
point:Point -> Shape
public function GetChildAtPoint(
point : Point
) : Shape
參數
- point
類型:Point
傳回值
類型:Microsoft.VisualBasic.PowerPacks.Shape
表示位於指定點上之圖案的 Shape。
備註
如果沒有圖案在指定的點, GetChildAtPoint 方法不會有任何作用。
注意事項 |
---|
pt 參數會以螢幕座標表示的 Point 。必須轉換成使用 PointToScreen 方法,此為工作區座標。 |
範例
下列範例示範如何使用 GetChildAtPoint 方法會傳回所找到的圖案使用者按一下的位置。 這個範例要求您的表單上必須有至少一個 RectangleShape 控制項。
Private Sub ShapeContainer1_MouseDown(
ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs
) Handles ShapeContainer1.MouseDown
Dim sh As Shape
' Find the shape at the point where the mouse was clicked.
sh = ShapeContainer1.GetChildAtPoint(New Point(e.X, e.Y))
MsgBox(sh.Name)
End Sub
private void shapeContainer1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
Shape sh;
// Find the shape at the point where the mouse was clicked.
sh = shapeContainer1.GetChildAtPoint(new Point(e.X, e.Y));
MessageBox.Show(sh.Name);
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)