MoveTo Method

MoveTo Method

Sets the position of the PenInputPanel object to a static screen position.

Declaration

[C++]

HRESULT MoveTo (
    [in] long Left
    [in] long Top
);

[Microsoft® Visual Basic® 6.0]

Public Sub MoveTo ( _
    Left as Long, _
    Top as Long _
)

Parameters

Left

Indicates the new horizontal position in screen coordinates.

Top

Indicates the new vertical position in screen coordinates.

Return Value

HRESULT value Description
S_OK Success.
E_UNEXPECTED Unexpected parameter or property type.
E_FAIL An unspecified error occurred.

Remarks

The MoveTo method causes an error if the control to which the PenInputPanel is attached does not have focus. This method can be safely called if the pen input panel is not visible, as long as the attached control has focus.

If the new position causes the panel to appear outside the boundary of the screen working area, the panel is shifted toward the center of the working area so that the edges of the panel are adjacent to the nearest edges of the screen.

To explicitly override the automatic positioning behavior of the PenInputPanel object, use the Left and Top properties of the PenInputPanel object to determine its current position. If the PenInputPanel is located on a section of the screen that should be visible, use the MoveTo method to relocate the PenInputPanel.

You can also override the automatic positioning behavior of the PenInputPanel object by monitoring to the Left and Top parameters passed to a PanelMoving event handler. If the PenInputPanel is located on a section of the screen that should be visible, use the MoveTo method to relocate the PenInputPanel.

When the MoveTo method is called, the Tablet PC Input Panel hover target is disabled.

Examples

[Visual Basic 6.0]

This Visual Basic 6.0 example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, InkEdit1. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the pen input panel is visible, its position is changed to screen coordinates 100, 100 by calling the MoveTo method.

' Declare a new PenInputPanel object
Dim WithEvents thePenInputPanel As PenInputPanel

Private Sub Form_Load()
  ' Create the PenInputPanel
  Set thePenInputPanel = New PenInputPanel

  ' Attach the PenInputPanel to an InkEdit control
  thePenInputPanel.AttachedEditWindow = InkEdit1.hWnd

End Sub

Private Sub thePenInputPanel_VisibleChanged( _
                  ByVal NewVisibility As Boolean)
  ' If the panel has become visible...
  If NewVisibility Then
    ' Move the pen input panel to screen position 100, 100
    thePenInputPanel.MoveTo 100, 100
  End If
End Sub

Applies To