共用方式為


Ink.HitTest 方法 (array<Point[], Single, array<Point[]%)

傳回聚合線 (Polyline) 選取界限內包含的 Strokes 集合。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Function HitTest ( _
    points As Point(), _
    percentIntersect As Single, _
    <OutAttribute> ByRef lassoPoints As Point() _
) As Strokes
'用途
Dim instance As Ink
Dim points As Point()
Dim percentIntersect As Single
Dim lassoPoints As Point()
Dim returnValue As Strokes

returnValue = instance.HitTest(points, _
    percentIntersect, lassoPoints)
public Strokes HitTest(
    Point[] points,
    float percentIntersect,
    out Point[] lassoPoints
)
public:
Strokes^ HitTest(
    array<Point>^ points, 
    float percentIntersect, 
    [OutAttribute] array<Point>^% lassoPoints
)
public Strokes HitTest(
    Point[] points,
    float percentIntersect,
    /** @attribute OutAttribute */ /** @ref */Point[] lassoPoints
)
public function HitTest(
    points : Point[], 
    percentIntersect : float, 
    lassoPoints : Point[]
) : Strokes

參數

  • points
    型別:array<System.Drawing.Point[]
    在選取界限中用來選取 Stroke 物件的點。選取區域是界限首度與本身產生交集的選取界限內的區域。
  • percentIntersect
    型別:System.Single
    要成為點擊條件時,交集必須重疊的百分比。
  • lassoPoints
    型別:array<System.Drawing.Point[]%
    這個方法傳回時,所包含的輸出參數表示選取界限中用於選取範圍的特定部分。因為使用者可以繪製許多不同形狀的界限,其中部分可能會重疊許多次,所以在說明界限的哪個部分是用於選取範圍時,這個方法就很有用。這個參數是以未初始化的狀態傳遞。

傳回值

型別:Microsoft.Ink.Strokes
指定之區域中包含的 Strokes 集合。

備註

如果選取界限並沒有與本身產生交集,HitTest 方法會在陣列尾端加入點,以建立一條從第一個點延伸到最後一個點的直線。如果界限是條直線,其選取界限內沒有包含任何區域,則不會選取任何 Stroke 物件。

如果點參數是 nullNull 參照 (即 Visual Basic 中的 Nothing) (在 Microsoft Visual Basic .NET 中為 Nothing) 或者包含的點數少於 3 個點,則這個方法會擲回例外狀況。

範例

這個 C# 範例會使用 Point 物件 (theSelectionBoundary) 的陣列,從 Ink 物件 (theInk) 選取 Strokes 集合。percentIntersect 參數是設為 50.0,所以 Stroke 物件中必須至少要有 50% 的點包含在選取界限內,才能包含在 Strokes 集合 (theStrokes) 中。實際上用於選取 Stroke 物件的點,會以 Point 物件 (selectedPointsUsed) 之陣列的方式傳回。

Strokes theStrokes = theInk.HitTest(theSelectionBoundary, 50.0f, selectedPointsUsed);

這個 Microsoft Visual Basic .NET 範例會使用 Point 物件 (theSelectionBoundary) 的陣列,從 Ink 物件 (theInk) 選取 Strokes 集合。percentIntersect 參數是設為 50.0,所以 Stroke 物件中必須至少要有 50% 的點包含在選取界限內,才能包含在 Strokes 集合 (theStrokes) 中。實際上用於選取 Stroke 物件的點,會以 Point 物件 (selectedPointsUsed) 之陣列的方式傳回。

Dim theStrokes As Strokes = theInk.HitTest(theSelectionBoundary, 50.0, selectedPointsUsed)

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

Ink 類別

Ink 成員

HitTest 多載

Microsoft.Ink 命名空間

Strokes

ExtendedProperties