GeometryHitTestParameters(Geometry) 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用指定的 Geometry 將 GeometryHitTestParameters 類別的新執行個體初始化。
public:
GeometryHitTestParameters(System::Windows::Media::Geometry ^ geometry);
public GeometryHitTestParameters (System.Windows.Media.Geometry geometry);
new System.Windows.Media.GeometryHitTestParameters : System.Windows.Media.Geometry -> System.Windows.Media.GeometryHitTestParameters
Public Sub New (geometry As Geometry)
參數
範例
下列範例示範如何使用 方法來設定點擊測試 GeometryHitTestParameters HitTest 。 值 Point 可用來建立 Geometry 物件,以將點擊測試的範圍展開到較寬的顯示區域。
// Retrieve the coordinate of the mouse position.
Point pt = e.GetPosition((UIElement)sender);
// Expand the hit test area by creating a geometry centered on the hit test point.
EllipseGeometry expandedHitTestArea = new EllipseGeometry(pt, 10.0, 10.0);
// Set up a callback to receive the hit test result enumeration.
VisualTreeHelper.HitTest(myControl, null,
new HitTestResultCallback(MyHitTestResultCallback),
new GeometryHitTestParameters(expandedHitTestArea));
' Retrieve the coordinate of the mouse position.
Dim pt As Point = e.GetPosition(CType(sender, UIElement))
' Expand the hit test area by creating a geometry centered on the hit test point.
Dim expandedHitTestArea As New EllipseGeometry(pt, 10.0, 10.0)
' Set up a callback to receive the hit test result enumeration.
VisualTreeHelper.HitTest(myControl, Nothing, New HitTestResultCallback(AddressOf MyHitTestResultCallback), New GeometryHitTestParameters(expandedHitTestArea))