InkPicture.SelectionMoving Event
Assembly: Microsoft.Ink (in microsoft.ink.dll)
'Declaration Public Event SelectionMoving As InkOverlaySelectionMovingEventHandler 'Usage Dim instance As InkPicture Dim handler As InkOverlaySelectionMovingEventHandler AddHandler instance.SelectionMoving, handler
/** @event */ public void add_SelectionMoving (InkOverlaySelectionMovingEventHandler value) /** @event */ public void remove_SelectionMoving (InkOverlaySelectionMovingEventHandler value)
In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.
The event handler receives an argument of type InkOverlaySelectionMovingEventArgs that contains data about this event.
When you create an InkOverlaySelectionMovingEventHandler delegate, you identify the method that handles 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.
This C# example is a SelectionMoving event handler that affects a selection of an InkPicture control before the selection has been moved. If the selection will be moved so that any of it is outside the bounds of the window, the event handler turns the selection red. Note that the event handler sets the Stroke objects' Color to red.
[C#]
using Microsoft.Ink;
//...
theInkPicture.SelectionMoved += new InkOverlaySelectionMovedEventHandler(theInkPicture_SelectionMoved);
//...
private void theInkPicture_SelectionMoving(object sender, InkOverlaySelectionMovingEventArgs e)
{
if (e.NewPixelRect.Left < 0 || e.NewPixelRect.Right > ClientRectangle.Width ||
e.NewPixelRect.Top < 0 || e.NewPixelRect.Bottom > ClientRectangle.Height)
{
foreach (Stroke stroke in theInkPicture.Selection)
{
stroke.DrawingAttributes.Color = Color.Red;
}
// Update the color
Invalidate(e.NewPixelRect);
}
}
//...
This Microsoft® Visual Basic® .NET example is a SelectionMoving event handler that affects a selection of an InkPicture control before the selection has been moved. If the selection will be moved so that any of it is outside the bounds of the window, the event handler turns the selection red. Note that the event handler sets the Stroke objects' Color to red.
[Visual Basic]
Imports Microsoft.Ink
'...
Private WithEvents theInkPicture As InkPicture
'...
Private Sub theInkPicture_SelectionMoving(ByVal sender As Object, _
ByVal e As Microsoft.Ink.InkOverlaySelectionMovingEventArgs) _
Handles theInkPicture.SelectionMoving
If e.NewPixelRect.Left < 0 Or e.NewPixelRect.Right > ClientRectangle.Width Or _
e.NewPixelRect.Top < 0 Or e.NewPixelRect.Bottom > ClientRectangle.Height Then
Dim selectedStroke As Stroke
For Each selectedStroke In theInkPicture.Selection
selectedStroke.DrawingAttributes.Color = Color.Red
Next
' Update the color
Invalidate(e.NewPixelRect)
End If
End Sub
'...
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.