Compartir a través de


InkOverlaySelectionResizedEventArgs.OldSelectionBoundingRect Property

Gets the bounding rectangle of the selected Strokes collection as it existed before the SelectionResized event fired.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public ReadOnly Property OldSelectionBoundingRect As Rectangle
'Usage
Dim instance As InkOverlaySelectionResizedEventArgs
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 size of the selected Strokes collection as it existed before the SelectionResized event fired.

Remarks

The OldSelectionBoundingRect property provides specific information about the InkOverlaySelectionResizedEventArgs event.

Note

This rectangle is specified in ink space coordinates, which allows for undo scenarios.

Example

This C# example creates an event handler, theInkOverlay_SelectionMoved, that affects a selection after it has been resized. If the selected Strokes collection has been resized so that either dimension is smaller than 500 HIMETRIC units, the event handler restores that selection to its previous size.

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 too small
       if (newBounds.Height < 500 || newBounds.Width < 500)
       {
           // Resize to back to original rectangle
           theInkOverlay.Selection.ScaleToRectangle(e.OldSelectionBoundingRect);

           // 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 resized. If the selected Strokes collection has been resized so that either dimension is smaller than 500 HIMETRIC units, the event handler restores that selection to its previous size.

Imports Microsoft.Ink
'...
    Private WithEvents theInkOverlay As InkOverlay
'...
    Private Sub theInkOverlay_SelectionResized(ByVal sender As Object, _
    ByVal e As Microsoft.Ink.InkOverlaySelectionResizedEventArgs) _
    Handles theInkOverlay.SelectionResized
        Dim newBounds As Rectangle = theInkOverlay.Selection.GetBoundingBox()

        ' Check if the selection is too small
        If newBounds.Height < 500 Or newBounds.Width < 500 Then
            ' Resize to back to original rectangle
            theInkOverlay.Selection.ScaleToRectangle(e.OldSelectionBoundingRect)

            ' 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

InkOverlaySelectionResizedEventArgs Class
InkOverlaySelectionResizedEventArgs Members
Microsoft.Ink Namespace
InkOverlay
InkOverlay.SelectionResized