InkOverlay.SelectionMoving Event
Occurs when the position of the current selection is about to change, such as through alterations to the user interface, cut-and-paste procedures, or the Selection property.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public Event SelectionMoving As InkOverlaySelectionMovingEventHandler
'Usage
Dim instance As InkOverlay
Dim handler As InkOverlaySelectionMovingEventHandler
AddHandler instance.SelectionMoving, handler
public event InkOverlaySelectionMovingEventHandler SelectionMoving
public:
event InkOverlaySelectionMovingEventHandler^ SelectionMoving {
void add (InkOverlaySelectionMovingEventHandler^ value);
void remove (InkOverlaySelectionMovingEventHandler^ value);
}
/** @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.
Remarks
The event handler receives an argument of type InkOverlaySelectionMovingEventArgs containing data about this event.
When you create a 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.
Example
This C# example is a SelectionMoving event handler that affects a selection of an InkOverlay object 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.
using Microsoft.Ink;
//...
theInkOverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(theInkOverlay_SelectionMoved);
//...
private void theInkOverlay_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 theInkOverlay.Selection)
{
stroke.DrawingAttributes.Color = Color.Red;
}
// Update the color
Invalidate(e.NewPixelRect);
}
}
//...
This Microsoft Visual Basic .NET event handler that affects selection of an InkOverlay object before the selection is 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.
Imports Microsoft.Ink
'...
Private WithEvents theInkOverlay As InkOverlay
'...
Private Sub theInkOverlay_SelectionMoving(ByVal sender As Object, _
ByVal e As Microsoft.Ink.InkOverlaySelectionMovingEventArgs) _
Handles theInkOverlay.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 theInkOverlay.Selection
selectedStroke.DrawingAttributes.Color = Color.Red
Next
' Update the color
Invalidate(e.NewPixelRect)
End If
End Sub
'...
Platforms
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.
Version Information
.NET Framework
Supported in: 3.0
See Also
Reference
InkOverlay Class
InkOverlay Members
Microsoft.Ink Namespace
InkOverlaySelectionMovedEventArgs
InkOverlay.Selection
InkOverlay.SelectionMoved