InkOverlaySelectionMovingEventArgs.NewPixelRect Property
InkOverlaySelectionMovingEventArgs.NewPixelRect Property |
Gets the rectangle to which the selection is moved after the SelectionMoving event.
Definition
Visual Basic .NET Public ReadOnly Property NewPixelRect As Rectangle C# public Rectangle NewPixelRect { get; } Managed C++ public: __property Rectangle* get_NewPixelRect();
Property Value
System.Drawing.Rectangle. The rectangle to which the selection is moved after the SelectionMoving event.
This property is read-only. This property has no default value.
Examples
[C#]
This C# example creates an event handler, theInkOverlay_SelectionMoving, that affects a selected Strokes collection of an InkOverlay, theInkOverlay. If the selection is moved 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 moved back within the boundaries.)
using Microsoft.Ink; //... theInkOverlay.SelectionMoving += new InkOverlaySelectionMovingEventHandler(theInkOverlay_SelectionMoving); //... private void theInkOverlay_SelectionMoving(object sender, InkOverlaySelectionMovingEventArgs e) { //Check the bounds of the moving 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; } } } //...
[Visual Basic .NET]
This Microsoft® Visual Basic® .NET example creates an event handler, theInkOverlay_SelectionMoving, that affects a selected Strokes collection of an InkOverlay, theInkOverlay. If the selection is moved 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 moved back within the boundaries.)
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 ' Check the bounds of the moving 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 '...
See Also