共用方式為


PenInputPanel.Top 屬性

已取代。取得 PenInputPanel 物件上邊緣的垂直 (或 Y 軸) 位置 (以螢幕座標表示)。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public ReadOnly Property Top As Integer
'用途
Dim instance As PenInputPanel
Dim value As Integer

value = instance.Top
public int Top { get; }
public:
property int Top {
    int get ();
}
/** @property */
public int get_Top()
public function get Top () : int

屬性值

型別:System.Int32
PenInputPanel 物件上邊緣的垂直 (Y 軸) 位置 (以螢幕座標表示)。

備註

若要明確覆寫 PenInputPanel 物件的自動定位行為,請使用物件的 Left 和 Top 屬性判斷畫筆輸入面板目前的位置。

您也可以透過在 PanelMoving 事件期間接聽 PenInputPanelMovingEventArgs 物件的 LeftTop 屬性,覆寫 PenInputPanel 物件的自動定位行為。

ms571982.alert_security(zh-tw,VS.90).gif安全性注意事項:

如果在部分信任的情況下使用,除了 PenInputPanel 所需的權限之外,這個屬性還需要 SecurityPermissionFlag.AllFlags (英文) 權限。如需詳細資訊,請參閱Security and Trust

範例

這個 C# 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。接著會附加名為 VisibleChanged_Event 的 VisibleChanged 事件處理常式。事件處理常式會使用 Top 屬性將句子加入至 theInkEdit 的內容,說明 PenInputPanel 物件上邊緣的位置 (以螢幕座標表示)。

[C#]

//...

// 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";
        }
    }
}

這個 Microsoft® Visual Basic® .NET 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。接著會附加名為 VisibleChanged_Event 的 VisibleChanged 事件處理常式。事件處理常式會使用 Top 屬性將句子加入至 theInkEdit 的內容,說明 PenInputPanel 物件上邊緣的位置 (以螢幕座標表示)。

[Visual Basic]

'...

' 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

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

PenInputPanel 類別

PenInputPanel 成員

Microsoft.Ink 命名空間

PenInputPanel.Left