InkOverlaySelectionResizingEventArgs.NewPixelRect Property
Gets the bounding rectangle of the selection after the SelectionResizing event, as a Rectangle structure.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public ReadOnly Property NewPixelRect As Rectangle
'Usage
Dim instance As InkOverlaySelectionResizingEventArgs
Dim value As Rectangle
value = instance.NewPixelRect
public Rectangle NewPixelRect { get; }
public:
property Rectangle NewPixelRect {
Rectangle get ();
}
/** @property */
public Rectangle get_NewPixelRect ()
public function get NewPixelRect () : Rectangle
Not applicable.
Property Value
The size of the selection after the SelectionResizing event.
Remarks
The NewPixelRect property provides specific information about the InkOverlaySelectionResizingEventArgs event.
Note
This Rectangle structure is specified in client window coordinates, which allows for scenarios such as maintaining the aspect ratio when resizing.
Example
This C# example creates an event handler, theInkOverlay_SelectionResizing
, that affects a selected Strokes collection of an InkOverlay, theInkOverlay
. If the selection is resized so that any of it extends beyond the boundaries of the control, the event handler turns the selection red. (Note that the handler sets the Color property to red for each Stroke in the Strokes collection, so it will be red even if the strokes are resized back within the boundaries.)
using Microsoft.Ink;
//...
theInkOverlay.SelectionResizing += new InkOverlaySelectionResizingEventHandler(theInkOverlay_SelectionResizing);
//...
private void theInkOverlay_SelectionResizing(object sender, InkOverlaySelectionResizingEventArgs e)
{
//Check the bounds of the resizing selection to see if it goes outside.
if (e.NewPixelRect.Left < 0 || e.NewPixelRect.Right > ClientRectangle.Width ||
e.NewPixelRect.Top < 0 || e.NewPixelRect.Bottom > ClientRectangle.Height)
{
//If too big change the color of the strokes to red.
foreach (Stroke stroke in theInkOverlay.Selection)
{
stroke.DrawingAttributes.Color = Color.Red;
}
}
}
//...
This Microsoft® Visual Basic® .NET example creates an event handler, theInkOverlay_SelectionResizing
, that affects a selected Strokes collection of an InkOverlay, theInkOverlay
. If the selection is resized so that any of it extends beyond the boundaries of the control, the event handler turns the selection red. (Note that the handler sets the Color property to red for each Stroke in the Strokes collection, so it will be red even if the strokes are resized back within the boundaries.)
Imports Microsoft.Ink
'...
Private WithEvents theInkOverlay As InkOverlay
'...
Private Sub theInkOverlay_SelectionResizing(ByVal sender As Object, _
ByVal e As Microsoft.Ink.InkOverlaySelectionResizingEventArgs) _
Handles theInkOverlay.SelectionResizing
' Check the bounds of the resizing selection to see if it goes outside.
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
'If too big change the color of the strokes to red.
For Each selectedStroke In theInkOverlay.Selection
selectedStroke.DrawingAttributes.Color = Color.Red
Next
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
InkOverlaySelectionResizingEventArgs Class
InkOverlaySelectionResizingEventArgs Members
Microsoft.Ink Namespace
InkOverlay
InkOverlay.SelectionResizing