Share via


Gesture.HotPoint Property

Gets the hot point of the gesture, in ink space coordinates.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property HotPoint As Point
'Usage
Dim instance As Gesture 
Dim value As Point 

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

Property Value

Type: System.Drawing.Point
The hot point of the gesture, in ink space coordinates.

Remarks

The hot point is the one distinguishing point of a gesture. It is usually the point of the angle in a gesture or the point at which the gesture is intended to occur in relation to the content around it. If thee is no discernable hot point for a known gesture, the starting point of the gesture is the hot point.

For example, the hot point of the Check gesture is the point of the angle, and the hot point of the Curlicue gesture, in the ApplicationGesture enumeration, is the start of the stroke that is the gesture.

For more information about how a hot point is used, see Using Gestures.

Examples

In this example, an event handler fires when an application gesture is recognized. Only ApplicationGesture types that have been specifically requested by the application (by calling the SetGestureStatus method) will fire the event. In examining the first Gesture object passed to the event handler, if the Confidence property is set to strong confidence for a Check gesture, a small circle is drawn around the coordinates represented by the HotPoint property.

' 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;
        }
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Gesture Class

Gesture Members

Microsoft.Ink Namespace

ApplicationGesture

SystemGesture