GeometryHitTestParameters(Geometry) 建構函式

定義

使用指定的 GeometryGeometryHitTestParameters 類別的新執行個體初始化。

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)

參數

geometry
Geometry

用於點擊測試幾何的 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))

適用於

另請參閱