Freigeben über


InkPicture.SelectionChanging Event

InkPicture.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.

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 InkPicture named theInkPicture. 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;
//...
  theInkPicture.SelectionChanging += new InkOverlaySelectionChangingEventHandler(theInkPicture_SelectionChanging);
//...
  private void theInkPicture_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 InkPicture named theInkPicture. 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 theInkPicture As InkPicture
'...
    Private Sub theInkPicture_SelectionChanging(ByVal sender As Object, _
        ByVal e As Microsoft.Ink.InkOverlaySelectionChangingEventArgs) _
    Handles theInkPicture.SelectionChanging
        Dim selectedStroke As Stroke
        For Each selectedStroke In e.NewSelection
            selectedStroke.DrawingAttributes.Color = Color.Red
        Next
    End Sub
'...

See Also