InkPicture.SelectionResizing Event
Occurs when the size 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 SelectionResizing As InkOverlaySelectionResizingEventHandler
'Usage
Dim instance As InkPicture
Dim handler As InkOverlaySelectionResizingEventHandler
AddHandler instance.SelectionResizing, handler
public event InkOverlaySelectionResizingEventHandler SelectionResizing
public:
event InkOverlaySelectionResizingEventHandler^ SelectionResizing {
void add (InkOverlaySelectionResizingEventHandler^ value);
void remove (InkOverlaySelectionResizingEventHandler^ value);
}
/** @event */
public void add_SelectionResizing (InkOverlaySelectionResizingEventHandler value)
/** @event */
public void remove_SelectionResizing (InkOverlaySelectionResizingEventHandler 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 InkOverlaySelectionResizingEventArgs that contains data about this event.
When you create an InkOverlaySelectionResizingEventHandler 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 SelectionResizing event handler that affects a selection of an InkPicture control before it has been resized. If the selection will be resized so that any of it will be outside the bounds of the parent window, then the event handler turns the selection red. Note that the event handler sets the Stroke objects' DrawingAttributes.Color property to red.
[C#]
using Microsoft.Ink;
//...
theInkPicture.SelectionMoved += new InkOverlaySelectionMovedEventHandler(theInkPicture_SelectionMoved);
//...
private void theInkPicture_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 theInkPicture.Selection)
{
stroke.DrawingAttributes.Color = Color.Red;
}
// Update the color
Invalidate(e.NewPixelRect);
}
}
//...
This Microsoft® Visual Basic® .NET example is a SelectionResizing event handler that affects a selection of an InkPicture control before it has been resized. If the selection will be resized so that any of it will be outside the bounds of the parent window, then the event handler turns the selection red. Note that the event handler sets the Stroke objects' DrawingAttributes.Color property to red.
[Visual Basic]
Imports Microsoft.Ink
'...
Private WithEvents theInkPicture As theInkPicture
'...
Private Sub theInkPicture_SelectionMoving(ByVal sender As Object, _
ByVal e As Microsoft.Ink.InkOverlaySelectionMovingEventArgs) _
Handles theInkPicture.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 theInkPicture.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
InkPicture Class
InkPicture Members
Microsoft.Ink Namespace
InkOverlaySelectionResizingEventArgs
InkPicture.Selection
InkPicture.SelectionResized