共用方式為


PenInputPanel.MoveTo 方法

已取代。將 PenInputPanel 物件的位置設定為已定義的螢幕位置。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。

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

語法

'宣告
<UIPermissionAttribute(SecurityAction.Demand, Window := UIPermissionWindow.SafeTopLevelWindows)> _
<SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted := True)> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
Public Sub MoveTo ( _
    left As Integer, _
    top As Integer _
)
'用途
Dim instance As PenInputPanel
Dim left As Integer
Dim top As Integer

instance.MoveTo(left, top)
[UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public void MoveTo(
    int left,
    int top
)
[UIPermissionAttribute(SecurityAction::Demand, Window = UIPermissionWindow::SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction::Demand, Unrestricted = true)]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
public:
void MoveTo(
    int left, 
    int top
)
/** @attribute UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows) */
/** @attribute SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true) */
/** @attribute PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust") */
public void MoveTo(
    int left,
    int top
)
public function MoveTo(
    left : int, 
    top : int
)

參數

備註

如果焦點不在其中附加 PenInputPanel 物件的控制項中,則 MoveTo 方法會造成錯誤。如果「畫筆輸入面板」為隱藏狀態,只要焦點是在附加的控制項中,就可以安全地呼叫這個方法。

如果新位置造成面板出現在超出螢幕工作區界限以外的位置,則面板會朝工作區中央移動,以便讓面板的邊緣與最接近的螢幕邊緣相鄰。

若要明確覆寫 PenInputPanel 物件的自動定位行為,請使用 PenInputPanel 物件的 LeftTop 屬性決定其目前位置。如果 PenInputPanel 位於應顯示的螢幕區段中,請使用 MoveTo 方法重新放置 PenInputPanel

您也可以透過在 PanelMoving 事件期間監視 PenInputPanelMovingEventArgs 物件的 LeftTop 屬性,覆寫 PenInputPanel 物件的自動定位行為。如果 PenInputPanel 位於應顯示的螢幕區段中,請使用 MoveTo 方法重新放置 PenInputPanel

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

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

範例

這個 C# 範例會將 PenInputPanel 物件 thePenInputPanel 附加至 InkEdit 控制項 theInkEdit。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 加入至 PenInputPanel 的表單。在事件處理常式中,如果 PenInputPanel 物件是可見的,則會藉由呼叫 MoveTo 方法,將畫筆輸入面板的位置變更為螢幕座標 (100, 100)。

[C#]

//...

// Delcare 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 PenInputPanelVisibleChanged 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;

        // If the panel has become visible...
        if (e.NewVisibility)
        {
            // Move the pen input panel to
            // screen position (100, 100)
            theSenderPanel.MoveTo(100, 100);
        }
    }
}

這個 Microsoft® Visual Basic® .NET 範例會將 PenInputPanel 物件 (thePenInputPanel) 附加至 InkEdit 控制項 (theInkEdit)。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 加入至 PenInputPanel 的表單。在事件處理常式中,如果 PenInputPanel 物件是可見的,則會藉由呼叫 MoveTo 方法,將畫筆輸入面板的位置變更為螢幕座標 (100, 100)。

[Visual Basic]

'...

' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel

Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

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

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

'...

Public Sub VisibleChanged_Event(sender As Object, 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)

       ' If the panel has become visible...
       If e.NewVisibility Then
          ' Move the pen input panel to
          ' screen position 100, 100
            theSenderPanel.MoveTo(100, 100)
       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 命名空間