Compartir a través de


InkOverlay.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 InkOverlay
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 containing 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 InkOverlay 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.

using Microsoft.Ink;
//...
  theInkOverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(theInkOverlay_SelectionMoved);
//...
  private void theInkOverlay_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 theInkOverlay.Selection)
          {
              stroke.DrawingAttributes.Color = Color.Red;
          }
          // Update the color
          Invalidate(e.NewPixelRect);
     }

  }
//...

This Microsoft Visual Basic .NET example is an SelectionResizing event handler affecting a selection made using InkOverlay before it is resized. If any portion of the resized selection will be outside the bounds of the parent window, the event handler turns the selection red. Note that the event handler sets the Stroke objects' DrawingAttributes.Color property to red.

Imports Microsoft.Ink
'...
    Private WithEvents theInkOverlay As InkOverlay
'...
    Private Sub theInkOverlay_SelectionMoving(ByVal sender As Object, _
    ByVal e As Microsoft.Ink.InkOverlaySelectionMovingEventArgs) _
    Handles theInkOverlay.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 theInkOverlay.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

InkOverlay Class
InkOverlay Members
Microsoft.Ink Namespace
InkOverlay.SelectionResized
InkOverlay.Selection
InkOverlaySelectionResizingEventArgs