Visual.HitTestCore メソッド
定義
点またはジオメトリ値がビジュアル オブジェクトの境界内にあるかどうかを判断します。Determines whether a point or geometry value is within the bounds of the visual object.
オーバーロード
HitTestCore(GeometryHitTestParameters) |
ジオメトリ値がビジュアル オブジェクトの境界内にあるかどうかを判断します。Determines whether a geometry value is within the bounds of the visual object. |
HitTestCore(PointHitTestParameters) |
点の座標値がビジュアル オブジェクトの境界内にあるかどうかを判断します。Determines whether a point coordinate value is within the bounds of the visual object. |
HitTestCore(GeometryHitTestParameters)
ジオメトリ値がビジュアル オブジェクトの境界内にあるかどうかを判断します。Determines whether a geometry value is within the bounds of the visual object.
protected:
virtual System::Windows::Media::GeometryHitTestResult ^ HitTestCore(System::Windows::Media::GeometryHitTestParameters ^ hitTestParameters);
protected virtual System.Windows.Media.GeometryHitTestResult HitTestCore (System.Windows.Media.GeometryHitTestParameters hitTestParameters);
abstract member HitTestCore : System.Windows.Media.GeometryHitTestParameters -> System.Windows.Media.GeometryHitTestResult
override this.HitTestCore : System.Windows.Media.GeometryHitTestParameters -> System.Windows.Media.GeometryHitTestResult
Protected Overridable Function HitTestCore (hitTestParameters As GeometryHitTestParameters) As GeometryHitTestResult
パラメーター
- hitTestParameters
- GeometryHitTestParameters
ヒット テストの対象となる GeometryHitTestParameters を指定する Geometry オブジェクト。A GeometryHitTestParameters object that specifies the Geometry to hit test against.
戻り値
ヒット テストの結果を表す GeometryHitTestResult オブジェクト。A GeometryHitTestResult that represents the result of the hit test.
例
HitTestCore(GeometryHitTestParameters) メソッドをオーバーライドする方法を次の例に示します。The following example shows how to override the HitTestCore(GeometryHitTestParameters) method. このメソッドをオーバーライドする理由の1つは、ヒットテストプロセス中に追加機能を提供することです。One reason you might want to override this method is to provide additional functionality during the hit testing process.
// Override default hit test support in visual object.
protected override GeometryHitTestResult HitTestCore(GeometryHitTestParameters hitTestParameters)
{
IntersectionDetail intersectionDetail = IntersectionDetail.NotCalculated;
// Perform custom actions during the hit test processing.
return new GeometryHitTestResult(this, intersectionDetail);
}
' Override default hit test support in visual object.
Protected Overrides Overloads Function HitTestCore(ByVal hitTestParameters As GeometryHitTestParameters) As GeometryHitTestResult
Dim intersectionDetail As IntersectionDetail = IntersectionDetail.NotCalculated
' Perform custom actions during the hit test processing.
Return New GeometryHitTestResult(Me, intersectionDetail)
End Function
注釈
ビジュアルオブジェクトの既定のヒットテストのサポートは、メソッドをオーバーライドすることによってオーバーライドでき HitTestCore ます。You can override default hit testing support for a visual object by overriding the HitTestCore method. これは、HitTest メソッドを呼び出すと、HitTestCore のオーバーライドされた実装が呼び出されることを意味します。This means that when you invoke the HitTest method, your overridden implementation of HitTestCore is called. ビジュアルオブジェクトのジオメトリ外にある場合でも、ビジュアルオブジェクトの外接する四角形内でヒットテストが行われると、オーバーライドされたメソッドが呼び出されます。Your overridden method is called when a hit test falls within the bounding rectangle of the visual object, even if the coordinate falls outside the geometry of the visual object.
適用対象
HitTestCore(PointHitTestParameters)
点の座標値がビジュアル オブジェクトの境界内にあるかどうかを判断します。Determines whether a point coordinate value is within the bounds of the visual object.
protected:
virtual System::Windows::Media::HitTestResult ^ HitTestCore(System::Windows::Media::PointHitTestParameters ^ hitTestParameters);
protected virtual System.Windows.Media.HitTestResult HitTestCore (System.Windows.Media.PointHitTestParameters hitTestParameters);
abstract member HitTestCore : System.Windows.Media.PointHitTestParameters -> System.Windows.Media.HitTestResult
override this.HitTestCore : System.Windows.Media.PointHitTestParameters -> System.Windows.Media.HitTestResult
Protected Overridable Function HitTestCore (hitTestParameters As PointHitTestParameters) As HitTestResult
パラメーター
- hitTestParameters
- PointHitTestParameters
ヒット テストの対象となる PointHitTestParameters を指定する Point オブジェクト。A PointHitTestParameters object that specifies the Point to hit test against.
戻り値
ヒット テストから返される HitTestResult を表す Visual。A HitTestResult that represents the Visual that is returned from a hit test.
例
HitTestCore(PointHitTestParameters) メソッドをオーバーライドする方法を次の例に示します。The following example shows how to override the HitTestCore(PointHitTestParameters) method. このメソッドをオーバーライドする理由の1つは、ヒットテストプロセス中に追加機能を提供することです。One reason you might want to override this method is to provide additional functionality during the hit testing process.
// Override default hit test support in visual object.
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
{
Point pt = hitTestParameters.HitPoint;
// Perform custom actions during the hit test processing,
// which may include verifying that the point actually
// falls within the rendered content of the visual.
// Return hit on bounding rectangle of visual object.
return new PointHitTestResult(this, pt);
}
' Override default hit test support in visual object.
Protected Overrides Overloads Function HitTestCore(ByVal hitTestParameters As PointHitTestParameters) As HitTestResult
Dim pt As Point = hitTestParameters.HitPoint
' Perform custom actions during the hit test processing,
' which may include verifying that the point actually
' falls within the rendered content of the visual.
' Return hit on bounding rectangle of visual object.
Return New PointHitTestResult(Me, pt)
End Function
注釈
ビジュアルオブジェクトの既定のヒットテストのサポートをオーバーライドするには、メソッドをオーバーライドし HitTestCore ます。You can override the default hit testing support on visual objects by overriding the HitTestCore method. これは、HitTest メソッドを呼び出すと、HitTestCore のオーバーライドされた実装が呼び出されることを意味します。This means that when you invoke the HitTest method, your overridden implementation of HitTestCore is called. ビジュアルオブジェクトのジオメトリ外にある場合でも、ビジュアルオブジェクトの外接する四角形内でヒットテストが行われると、オーバーライドされたメソッドが呼び出されます。Your overridden method is called when a hit test falls within the bounding rectangle of the visual object, even if the coordinate falls outside the geometry of the visual object.