共用方式為


Gesture.HotPoint 屬性

取得「筆勢」在「筆墨空間」座標中的作用點。

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

語法

'宣告
Public ReadOnly Property HotPoint As Point
'用途
Dim instance As Gesture
Dim value As Point

value = instance.HotPoint
public Point HotPoint { get; }
public:
property Point HotPoint {
    Point get ();
}
/** @property */
public Point get_HotPoint()
public function get HotPoint () : Point

屬性值

型別:System.Drawing.Point
筆勢在筆墨空間座標中的作用點。

備註

作用點是筆勢的單一分辨點。它通常是筆勢中夾角的頂點,或是代表筆勢預定顯示位置 (相對於其周圍內容) 的點。如果已知筆勢沒有明顯的作用點,則筆勢的起點就是作用點。

例如,Check 筆勢的作用點是夾角頂點,而 Curlicue 筆勢在 ApplicationGesture 列舉型別中的作用點則是筆勢的起點。

如需如何使用熱點的詳細資訊,請參閱Using Gestures

範例

在這個範例中,當辨識「應用程式筆勢」時,會引發事件處理常式。只有應用程式特別要求的 ApplicationGesture 型別 (藉由呼叫 SetGestureStatus 方法) 才會引發事件。在檢查傳至事件處理常式的第一個 Gesture 物件時,如果針對 Check 筆勢將 Confidence 屬性設定為高度信賴,則會在 HotPoint 屬性所表示的座標周圍繪製小圓形。

' event handler for InkOverlay.Gesture event
Private Sub mInkObject_Gesture(ByVal sender As Object, ByVal e As InkCollectorGestureEventArgs)
    ' There might be more than one gesture passed in InkCollectorGestureEventArgs
    ' The gestures are arranged in order of confidence from most to least
    ' This event handler is only concerned with the first (most confident) gesture
    ' and only if the first gesture has RecognitionConfidence.Strong
    Dim G As Gesture = e.Gestures(0)

    ' if this is ApplicationGesture.Check of RecognitionConfidence.Strong confidence
    If ApplicationGesture.Check = G.Id And RecognitionConfidence.Strong = G.Confidence Then
        Dim mInkOverlay As InkOverlay = DirectCast(sender, InkOverlay)
        ' assuming here that InkOverlay.AttachedControl property is set.
        ' This can be set with the .ctor InkOverlay(Control C) or the
        ' InkOverlay.AttachedControl property can be set later.
        Using GR As Graphics = mInkOverlay.AttachedControl.CreateGraphics()
            ' get the hot point
            Dim hotPoint As Point = G.HotPoint
            ' convert to pixel coordinates
            mInkOverlay.Renderer.InkSpaceToPixel(GR, hotPoint)
            ' draw a small circle
            GR.DrawEllipse(Pens.Orange, hotPoint.X - 6, hotPoint.Y - 6, 12, 12)
            ' cancel the event. This prevents the gesture from disappearing
            ' and lets you see the small circle and the gesture together
            e.Cancel = True
        End Using
    End If
End Sub
// event handler for InkOverlay.Gesture event
private void mInkObject_Gesture(object sender, InkCollectorGestureEventArgs e)
{
    // There might be more than one gesture passed in InkCollectorGestureEventArgs
    // The gestures are arranged in order of confidence from most to least
    // This event handler is only concerned with the first (most confident) gesture
    // and only if the first gesture has RecognitionConfidence.Strong
    Gesture G = e.Gestures[0];

    // if this is ApplicationGesture.Check of RecognitionConfidence.Strong confidence
    if (ApplicationGesture.Check == G.Id && RecognitionConfidence.Strong == G.Confidence)
    {
        InkOverlay mInkOverlay = (InkOverlay)sender;
        // assuming here that InkOverlay.AttachedControl property is set.
        // This can be set with the .ctor InkOverlay(Control C) or the
        // InkOverlay.AttachedControl property can be set later.
        using (Graphics GR = mInkOverlay.AttachedControl.CreateGraphics())
        {
            // get the hot point
            Point hotPoint = G.HotPoint;
            // convert to pixel coordinates
            mInkOverlay.Renderer.InkSpaceToPixel(GR, ref hotPoint);
            // draw a small circle
            GR.DrawEllipse(Pens.Orange, hotPoint.X - 6, hotPoint.Y - 6, 12, 12);
            // cancel the event. This prevents the gesture from disappearing
            // and lets you see the small circle and the gesture together
            e.Cancel = true;
        }
    }
}

平台

Windows Vista

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

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

Gesture 類別

Gesture 成員

Microsoft.Ink 命名空間

ApplicationGesture

SystemGesture