Export (0) Print
Expand All

InkPicture.Selection Property

Gets or sets the Strokes collection that is currently selected inside the InkPicture control.

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

[BrowsableAttribute(false)]
public Strokes Selection { get; set; }

Property Value

Type: Microsoft.Ink.Strokes
The Strokes collection that is currently selected inside the InkPicture control. The default value is an empty Strokes collection.

To get the bounding rectangle of the Strokes collection after it has been moved or resized, call the GetBoundingBox method of the Strokes collection returned by this property.

To get the bounding rectangle of of the Strokes collection before it was moved, handle the SelectionMoved event and get the OldSelectionBoundingRect property of the InkOverlaySelectionMovedEventArgs object.

To get the bounding rectangle of of the Strokes collection before it was resized, handle the SelectionResized event and get the OldSelectionBoundingRect property of the InkOverlaySelectionResizedEventArgs object.

In this example, all strokes of the InkPicture object are selected by setting the Selection property to the same Strokes collection used by the associated Ink object.

After the selection is made, the EditingMode property is set to Select.

The EditingMode property cannot be changed while the object is collecting ink. Because ink collection is handled on a separate thread from your application code, the CollectingInk property can change to true while your application code is operating under the assumption that it is still false. To handle this contingency, access to the EditingMode property should be contained within a try-catch block.

// Select all strokes 
// mInkObject can be InkOverlay or InkPicture 
try
{
    if (!mInkObject.CollectingInk)
    {
        mInkObject.Selection = mInkObject.Ink.Strokes;
        mInkObject.EditingMode = InkOverlayEditingMode.Select;
    }
}
catch
{
    // handle or rethrow
}

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.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft