SetWindowInputRectangle Method

SetWindowInputRectangle Method

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

Declaration

[C++]

        HRESULT SetWindowInputRectangle (
    [in] IInkRectangle* windowRectangle
);
      

[Microsoft® Visual Basic® 6.0]

        Public Sub SetWindowInputRectangle( _
    windowRectangle As InkRectangle _
)
      

Parameters

windowRectangle

[in] The rectangle, in window coordinates, on which ink is drawn.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INVALIDARG The rectangle coordinates are invalid (for example, width/height of 0).
E_INK_COLLECTOR_BUSY Cannot update mappings while in the middle of a stroke.
E_INK_EXCEPTION An exception occurred inside the method.
E_INK_OVERLAPPING_INPUT_RECT The window input rectangle overlaps with the window input rectangle of an enabled InkCollector.

Remarks

The E_INK_OVERLAPPING_INPUT_RECT error is returned if the window input rectangle of an enabled ink collector (set with the Enabled property) overlaps the window input rectangle of another enabled ink collector.

Note: Overlap can occur without an error as long as only one of the input rectangles is enabled at any known time.

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 its default behavior (an empty rectangle with coordinates {0,0,0,0}), pass {0,0,0,0} in the call to SetWindowInputRectangle, and not NULL (Nothing in Visual Basic 6.0).

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

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

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows how to call SetWindowInputRectangle to set the input area to the screen.

        Option Explicit
Dim theInkCollector As InkCollector

Private Sub Form_Load()
    Dim theInkRect As New InkRectangle
    theInkRect.SetRectangle 0, 0, 0, 0

    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.SetWindowInputRectangle theInkRect

    theInkCollector.Enabled = True
End Sub
      

Applies To