PointHitTestResult(Visual, Point) 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 PointHitTestResult 類別的新執行個體。
public:
PointHitTestResult(System::Windows::Media::Visual ^ visualHit, System::Windows::Point pointHit);
public PointHitTestResult (System.Windows.Media.Visual visualHit, System.Windows.Point pointHit);
new System.Windows.Media.PointHitTestResult : System.Windows.Media.Visual * System.Windows.Point -> System.Windows.Media.PointHitTestResult
Public Sub New (visualHit As Visual, pointHit As Point)
參數
範例
下列範例示範如何在使用者定義的視覺物件中覆寫預設點擊測試支援。 在此情況下,會建立新的 PointHitTestResult ,並從覆寫的方法傳回 。
// 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