InkOverlay.SelectionChanging Event

InkOverlay.SelectionChanging Event

Occurs when the selection of ink within the control is about to change, such as through alterations to the user interface, cut-and-paste procedures, or the Selection property.

Definition

Visual Basic .NET Public Event SelectionChanging As InkOverlaySelectionChangingEventHandler
C# public event InkOverlaySelectionChangingEventHandler SelectionChanging;
Managed C++ public: __event InkOverlaySelectionChangingEventHandler SelectionChanging;

Remarks

The event handler receives an argument of type InkOverlaySelectionChangingEventArgs that contains data about this event.

You can handle this event to change the default selection behavior of the InkOverlay object.

When you create an InkOverlaySelectionChangingEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For performance reasons, the default event interest is off but is turned on automatically if you add an event handler.

Examples

[C#]

This C# example demonstrates adding a SelectionChanging event hander to an InkOverlay named theInkOverlay. Before the selection actually occurs, the colors of the selected strokes are turned red. (Note that this permanently turns the selected strokes red.)

using Microsoft.Ink;
//...
  theInkOverlay.SelectionChanging += new InkOverlaySelectionChangingEventHandler(theInkOverlay_SelectionChanging);
//...
  private void theInkOverlay_SelectionChanging(object sender, InkOverlaySelectionChangingEventArgs e)
  {
     foreach (Stroke selectedStroke in e.NewSelection)
     {
         selectedStroke.DrawingAttributes.Color = Color.Red;
     }
  }
//...

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example demonstrates adding a SelectionChanging event hander to an InkOverlay named theInkOverlay. Before the selection actually occurs, the colors of the selected strokes are turned red. (Note that this permanently turns the selected strokes red.)

Imports Microsoft.Ink
'...
    Private WithEvents theInkOverlay As InkOverlay
'...
    Private Sub theInkOverlay_SelectionChanging(ByVal sender As Object, _
        ByVal e As Microsoft.Ink.InkOverlaySelectionChangingEventArgs) _
    Handles theInkOverlay.SelectionChanging
        Dim selectedStroke As Stroke
        For Each selectedStroke In e.NewSelection
            selectedStroke.DrawingAttributes.Color = Color.Red
        Next
    End Sub
'...

See Also