InkOverlaySelectionMovedEventArgs.OldSelectionBoundingRect Property
Gets the bounding rectangle of the selected Strokes collection as it existed before the SelectionMoved event fired.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public ReadOnly Property OldSelectionBoundingRect As Rectangle
'Usage
Dim instance As InkOverlaySelectionMovedEventArgs
Dim value As Rectangle
value = instance.OldSelectionBoundingRect
public Rectangle OldSelectionBoundingRect { get; }
public:
property Rectangle OldSelectionBoundingRect {
Rectangle get ();
}
/** @property */
public Rectangle get_OldSelectionBoundingRect ()
public function get OldSelectionBoundingRect () : Rectangle
Not applicable.
Property Value
The bounding rectangle of the selected Strokes collection as it existed before the SelectionMoved event fired.
Remarks
The OldSelectionBoundingRect property gets the position that the selected Strokes collection was located in before the SelectionMoved event fired.
Example
This C# example creates an event handler, theInkOverlay_SelectionMoved
, that affects a selection after it has been moved. If the selected Strokes collection has been moved so that any part of the collection is positioned outside the left or top boundaries of the InkOverlay object, theInkOverlay
, the event handler moves the selection back to its original position.
using Microsoft.Ink;
//...
theInkOverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(theInkOverlay_SelectionMoved);
//...
private void theInkOverlay_SelectionMoved(object sender, InkOverlaySelectionMovedEventArgs e)
{
Rectangle newBounds = theInkOverlay.Selection.GetBoundingBox();
// Check if the selection is positioned outside the left or top boundaries
// of the window.
if (newBounds.Left < 0 || newBounds.Top < 0)
{
// Move to back to original location
theInkOverlay.Selection.Move(e.OldSelectionBoundingRect.Left - newBounds.Left,
e.OldSelectionBoundingRect.Top - newBounds.Top);
// Trick to insure that selection handles are updated
theInkOverlay.Selection = theInkOverlay.Selection;
}
}
//...
This Microsoft® Visual Basic® .NET example creates an event handler, theInkOverlay_SelectionMoved
, that affects a selection after it has been moved. If the selected Strokes collection has been moved so that any part of the collection is positioned outside the left or top boundaries of the InkOverlay object, theInkOverlay
, the event handler moves the selection back to its original position.
Imports Microsoft.Ink
'...
Private WithEvents theInkOverlay As InkOverlay
'...
Private Sub theInkOverlay_SelectionMoved(ByVal sender As Object, _
ByVal e As Microsoft.Ink.InkOverlaySelectionMovedEventArgs) Handles theInkOverlay.SelectionMoved
Dim newBounds As Rectangle = theInkOverlay.Selection.GetBoundingBox()
'Check if if the selection is positioned outside the left or top boundaries
'of the window.
If newBounds.Left < 0 Or newBounds.Top < 0 Then
'Move to back to original location
theInkOverlay.Selection.Move(e.OldSelectionBoundingRect.Left - newBounds.Left, _
e.OldSelectionBoundingRect.Top - newBounds.Top)
'Trick to insure that selection handles are updated
theInkOverlay.Selection = theInkOverlay.Selection
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
InkOverlaySelectionMovedEventArgs Class
InkOverlaySelectionMovedEventArgs Members
Microsoft.Ink Namespace
InkOverlay
InkOverlay.SelectionMoved