Share via


InkPicture.SetWindowInputRectangle Method

InkPicture.SetWindowInputRectangle Method

Sets the window rectangle, in pixels, within which ink is drawn.

Definition

Visual Basic .NET Public Sub SetWindowInputRectangle( _
ByVal windowInputRectangle As Rectangle _
)
C# public void SetWindowInputRectangle(
Rectangle windowInputRectangle
);
Managed C++ public: void SetWindowInputRectangle(
Rectangle *windowInputRectangle
);

Parameters

windowInputRectangle System.Drawing.Rectangle. input rectangle in window coordinates

Exceptions

COMException Leave Site:
InvalidOperationException Leave Site: Cannot update the window input rectangle while collecting ink CollectingInk
ObjectDisposedException Leave Site:

Remarks

By default, the window input rectangle is set to {0,0,0,0}. This default rectangle maps to the size of the entire window.

To reset the window input rectangle to an empty rectangle with the default coordinates, pass {0,0,0,0} in the call to the SetWindowInputRectangle method, rather than null (Nothing in Microsoft® Visual Basic® .NET).

You cannot pass in a rectangle where the value of the Right Leave Site property is less than the value of the Left Leave Site property; or where the value of the Bottom Leave Site property is less than the value of the Top Leave Site property. For example, a rectangle with parameters of {500, 500, 400, 400} is not valid.

A rectangle in negative coordinate space can be specified but is meaningless, because it always results in a window that cannot be inked upon.

Caution: If you set the window input rectangle to overlap a Splitter control Leave Site or the borders of the window, unpredictable results may occur when the window is resized.

Examples

[C#]

This C# example calls the SetWindowInputRectangle method to set the ink input area to the size of the entire window of the InkPicture object, theInkPicture, to which it is attached.

using Microsoft.Ink;
//...
InkPicture theInkCollector;
public Form1()
{
    // Initialization
    theInkCollector = new InkPicture(Handle);
    Rectangle theRect = new Rectangle(0,0,0,0);
    theInkPicture.SetWindowInputRectangle(theRect);
    //...
}
                

[VB.NET]

This Visual Basic .NET example calls the SetWindowInputRectangle method to set the ink input area to the size of the entire window of the InkPicture object, theInkPicture, to which it is attached.

Imports Microsoft.Ink
Dim theInkPicture As InkPicture
Public Sub Form1()
    'Initialization
    Dim theRect As Rectangle
    theInkPicture = New InkPicture(Handle)
    theRect = New Rectangle(0,0,0,0)
    theInkPicture.SetWindowInputRectangle(theRect)
    '...
End Sub
                

See Also