Поделиться через


Creating a PenInputPanel Object

Creating a PenInputPanel Object

Description of creating a PenInputPanel object.

Managed code constructors provide a convenient way to create a PenInputPanel object and attach it to a control in one step. This C# example creates a PenInputPanel object and attaches it to an existing InkEdit control, InkEdit1, with one line of code.

PenInputPanel thePenInputPanel = new PenInputPanel(InkEdit1);

The same example in Microsoft® Visual Basic® .NET looks like this:

Dim thePenInputPanel As New PenInputPanel(InkEdit1)

This technique is useful in cases where one PenInputPanel object will be associated with a single control throughout its lifetime. In cases where you want to use one PenInputPanel object and associate it with multiple controls, as demonstrated in the PenInputPanel Sample, use the AttachedEditControl property to change the control to which the PenInputPanel object is associated.

To attach a PenInputPanel object to a control without using a constructor, use the AttachedEditControl property. Use this technique for languages that do not support the managed constructors, such as Visual Basic 6.0 or C++. The following Visual Basic 6.0 example creates a PenInputPanel object and attaches it to an existing InkEdit control, InkEdit1, by using the AttachedEditControl property.

' Declare a new PenInputPanel object
Dim thePenInputPanel As PenInputPanel

' Create the PenInputPanel
Set thePenInputPanel = New PenInputPanel

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