InkOverlaySelectionResizedEventArgs.OldSelectionBoundingRect Property
InkOverlaySelectionResizedEventArgs.OldSelectionBoundingRect Property |
Gets the bounding rectangle of the selected Strokes collection as it existed before the SelectionResized event fired.
Definition
Visual Basic .NET Public ReadOnly Property OldSelectionBoundingRect As Rectangle C# public Rectangle OldSelectionBoundingRect { get; } Managed C++ public: __property Rectangle* get_OldSelectionBoundingRect();
Property Value
System.Drawing.Rectangle. The size of the selected Strokes collection as it existed before the SelectionResized event fired.
This property is read-only. This property has no default value.
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.
Examples
[C#]
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; } } //...
[Visual Basic .NET]
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 '...
See Also