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 笔势的热点为拐点,ApplicationGesture 枚举中的 Curlicue 笔势的热点为该笔势的笔画的起点。

有关如何使用热点的更多信息,请参见Using Gestures

示例

在此示例中,识别应用程序笔势 时将激发一个事件处理程序。只有由应用程序通过调用 SetGestureStatus 方法专门请求的 ApplicationGesture 类型才会激发该事件。在检查传递给事件处理程序的第一个 Gesture 对象时,如果 Confidence 属性对某个 Check 笔势设置高置信度,则在由 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