Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

InkCanvas.SelectionResizing Event

Occurs at the onset of the selected strokes and elements being resized.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

'Declaration
Public Event SelectionResizing As InkCanvasSelectionEditingEventHandler
'Usage
Dim instance As InkCanvas
Dim handler As InkCanvasSelectionEditingEventHandler

AddHandler instance.SelectionResizing, handler

/** @event */
public void add_SelectionResizing (InkCanvasSelectionEditingEventHandler value)

/** @event */
public void remove_SelectionResizing (InkCanvasSelectionEditingEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
<object SelectionResizing="InkCanvasSelectionEditingEventHandler" .../>

This event occurs after the user requests a selection of strokes and/or elements to be resized and before the change is applied.

The event handler receives an argument of type InkCanvasSelectionEditingEventArgs that contains two properties, OldRectangle and NewRectangle, which respectively contain the rectangle that defines the boundaries of the selection before the resizing operation and the rectangle that defines the boundaries of the selection after the resizing operation.

After the strokes and/or elements have been updated with the new size, the SelectionResized event will occur.

The following example prevents the user from making a selection smaller than its original size.

Private selectionBounds As Rect

' Don't allow the user to make the selection smaller than its original size.
Sub inkCanvas1_SelectionResizing(ByVal sender As Object, ByVal e As InkCanvasSelectionEditingEventArgs)

    If selectionBounds.IsEmpty Then
        Return
    End If

    Dim resizeHeight As Double
    Dim resizeWidth As Double

    ' If the user made the height of the selection smaller, 
    ' use the selection's original height.
    If e.NewRectangle.Height < selectionBounds.Height Then
        resizeHeight = selectionBounds.Height
    Else
        resizeHeight = e.NewRectangle.Height
    End If

    ' If the user made the width of the selection smaller, 
    ' use the selection's original width.
    If e.NewRectangle.Width < selectionBounds.Width Then
        resizeWidth = selectionBounds.Width
    Else
        resizeWidth = e.NewRectangle.Width
    End If

    ' Create a the new rectangle with the appropriate width and height.
    e.NewRectangle = New Rect(e.NewRectangle.X, e.NewRectangle.Y, resizeWidth, resizeHeight)

End Sub 'inkCanvas1_SelectionResizing


' Keep track of the selection bounds.
Sub inkCanvas1_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)

    selectionBounds = inkCanvas1.GetSelectionBounds()

End Sub 'inkCanvas1_SelectionChanged

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.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2017 Microsoft