Compartir a través de


Width Property [PenInputPanel Class]

Width Property [PenInputPanel Class]

Gets the width of the pen input panel in client coordinates.

Declaration

[C++]

[propget] HRESULT Width (
    [out, retval] long *Width);

[Microsoft® Visual Basic® 6.0]

Public Property Get Width() as Integer

Property Value

long The width of the pen input panel in client coordinates.

This property is read-only.

Return Value

HRESULT value Description
S_OK Success.
E_FAIL An unspecified error occurred.

Remarks

The width of the PenInputPanel object is dependent on the screen resolution for the particular Tablet PC. The default value at 96 dots per inch (dpi) is 570 pixels. The default value at 120 dpi is 712 pixels. The default value at 133 dpi is 790 pixels.

Starting with Microsoft Windows® XP Tablet PC Edition with Windows XP Service Pack 2 (SP2), the Tablet PC Input Panel allows the user to continue entering by automatically increasing the size of the Input Panel to accommodate new handwriting. The Height and Width properties do not update to reflect the new size as the Input Panel grows. These properties return the original size of the Input Panel. They also do not report the dimensions of the Input Panel hover target.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, InkEdit1. It then attaches a VisibleChanged event handler, thePenInputPanel_VisibleChanged. In the event handler, it adds a sentence to the content of the edit control to which the PenInputPanel object is attached. The sentence states the width of the PenInputPanel object in pixels by retrieving the Width property.

' 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 thePenInputPanel.Visible Then
    ' Display the width of the panel in the InkEdit control
    InkEdit1.Text = "The width of the panel is " + _
                    Str(thePenInputPanel.Width) + _
                    " pixels." + CrLf
  End If
End Sub

Applies To