PenInputPanel.Top Property

PenInputPanel.Top Property

Gets the vertical, or y-axis, location of the top edge of the PenInputPanel object, in screen coordinates.

Definition

Visual Basic .NET Public ReadOnly Property Top As Integer
C# public int Top { get; }
Managed C++ public: __property int* get_Top();

Property Value

System.Int32. The vertical, or y-axis, location of the top edge of the PenInputPanel object, in screen coordinates.

This property is read-only. This property has no default value.

Exceptions

ObjectDisposedException Leave Site:

Remarks

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

You can also override the automatic positioning behavior of the PenInputPanel object by listening for the Left and Top properties of the PenInputPanelMovingEventArgs object during a PanelMoving event. If the pen input panel is located on a section of the screen that should be visible, use the MoveTo method to relocate the pen input panel.

Examples

[C#]

This C# example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, theInkEdit. It then attaches a VisibleChanged event handler, VisibleChanged_Event. The event handler uses the Top property to add a sentence to the content of theInkEdit, stating where the top edge of the PenInputPanel object is located, in screen coordinates.

//...

// Declare the PenInputPanel object
PenInputPanel thePenInputPanel;

public Form1()
{
    // Required for Windows Form Designer support
    InitializeComponent();

    // Create and attach the new PenInputPanel to an InkEdit control.
    thePenInputPanel = new PenInputPanel(theInkEdit);

    // Add a VisibleChanged event handler
    thePenInputPanel.VisibleChanged +=
        new PenInputPanelVisibleChangedEventHandler(VisibleChanged_Event);
}

//...

public void VisibleChanged_Event(object sender,
                                 PenInputPanelVisibleChangedEventArgs e)
{
    // Make sure the object that generated
    // the event is a PenInputPanel object
    if (sender is PenInputPanel)
    {
        PenInputPanel theSenderPanel = (PenInputPanel)sender;

        // When the panel has become visible...
        if (e.NewVisibility)
        {
            // Display the top edge of the panel
            // in the attached edit control
            theSenderPanel.AttachedEditControl.Text +=
                    "The top edge of the panel is at ";
            theSenderPanel.AttachedEditControl.Text += theSenderPanel.Top.ToString();
            theSenderPanel.AttachedEditControl.Text += " pixels.\n";
        }
    }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, theInkEdit. It then attaches a VisibleChanged event handler, VisibleChanged_Event. The event handler uses the Top property to add a sentence to the content of theInkEdit, stating where the top edge of the PenInputPanel object is located, in screen coordinates.

'...

' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel

Public Sub New()
    MyBase.New()

    ' Required for Windows Form Designer support
    InitializeComponent()

    ' Create and attach the new PenInputPanel to an InkEdit control.
    thePenInputPanel = New PenInputPanel(theInkEdit)

    ' Add a VisibleChanged event handler
    AddHandler thePenInputPanel.VisibleChanged, _
               AddressOf VisibleChanged_Event
End Sub 'New

'...

Public Sub VisibleChanged_Event(ByVal sender As Object, ByVal e As _
                                PenInputPanelVisibleChangedEventArgs)
    ' Make sure the object that generated
    ' the event is a PenInputPanel object
    If TypeOf sender Is PenInputPanel Then
        Dim theSenderPanel As PenInputPanel = CType(sender, PenInputPanel)

        ' When the panel has become visible...
        If e.NewVisibility Then
            ' Display the top edge of the panel
            ' in the attached edit control
            theSenderPanel.AttachedEditControl.Text += _
                     "The top edge of the panel is at "

            theSenderPanel.AttachedEditControl.Text += _
                     theSenderPanel.Top.ToString()

            theSenderPanel.AttachedEditControl.Text += _
                     " pixels." + ControlChars.Lf
        End If
    End If
End Sub 'VisibleChanged_Event

See Also