The LassoUI Class
This class is useful if you re implementing a custom selection mode or a real-time lasso selection. It implements the lasso dots seen in InkOverlay and Windows Journal.
To use the LassoUI class, create an instance using the new operator, call the Start method with the initial starting point of the lasso, and then repeatedly call the Continue method for subsequent points of the lasso. No calculation is required to measure distance or drop points to achieve the evenly spaced lasso dots the class handles this automatically. To obtain the array of points constituting the lasso, query the Points property.
LassoUI
public LassoUI()
Class constructor.
Start
public void Start(Graphics g, Point ptStart)
This method indicates the start of a lasso, typically called in response to an InkCollector or InkOverlay s CursorDown or SystemGesture.DragStart event. The ptStart parameter is specified in pixels.
Continue
public bool Continue(Graphics g, Point ptNew)
This method indicates the continuation of a lasso, typically called in response to an InkCollector or InkOverlay s Packets event. The ptNew parameter is specified in pixels.
Render
public void Render(Graphics g) public void Render(Graphics g, Rectangle rcClip)
These methods will draw the entire in-progress lasso, typically called in the Paint handler for the window being used to capture the lasso data. The rcClip parameter can be used to avoid the redundant painting of lasso dots and thus increase rendering performance.
Points
public Point[] Points
This property returns the array of pointsused to draw the lasso. This array should be used as the basis for the pointarray specified in the hit-testing computation. The values returned are in pixels, so make sure to convert them into ink space coordinates if they are to be used with the Ink.HitTest method.
BoundingRect
public Rectangle BoundingRect
This property returns the boundaries of the lasso currently in progress and is specified in pixels.
DotSpacing
public int DotSpacing
This property gets or sets the spacing between lasso dots and is specified in pixels.
DotSize
public int DotSize
This property gets or sets the size of each lasso dot and is specified in pixels.
DotBrush
public Brush DotBrush
This property gets or sets the brush used to draw lasso dots. By setting this property, you can alter the lasso color.