共用方式為


PenInputPanelMovingEventHandler 委派

表示處理 PenInputPanel 物件之 PanelMoving 事件的方法。

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

語法

'宣告
Public Delegate Sub PenInputPanelMovingEventHandler ( _
    sender As Object, _
    e As PenInputPanelMovingEventArgs _
)
'用途
Dim instance As New PenInputPanelMovingEventHandler(AddressOf HandlerMethod)
public delegate void PenInputPanelMovingEventHandler(
    Object sender,
    PenInputPanelMovingEventArgs e
)
public delegate void PenInputPanelMovingEventHandler(
    Object^ sender, 
    PenInputPanelMovingEventArgs^ e
)
/** @delegate */
public delegate void PenInputPanelMovingEventHandler(
    Object sender,
    PenInputPanelMovingEventArgs e
)
JScript 不支援委派。

參數

備註

PanelMoving 事件可以用來變更畫筆輸入面板的位置,只要透過變更 LeftTop 參數的方式即可。

警告

MoveToRefresh 方法會造成 PenInputPanel 物件呼叫其自動定位程式碼,該程式碼會觸發 PanelMoving 事件。因此,在 PenInputPanelMovingEventHandler 委派 (Delegate) 內呼叫這些方法可能導致無窮迴圈。

範例

這個 C# 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。接著會將 PanelMoving 事件處理常式和 VisibleChanged 事件處理常式加入至 thePenInputPanel。在 VisibleChanged 處理常式中,畫筆輸入面板的位置已變更,導致引發 PanelMoving 事件。接著,PanelMoving 處理常式會將所附加 InkEdit 控制項的文字設定為包含畫筆輸入面板的新螢幕座標的句子。

[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 PanelMoving event handler
    thePenInputPanel.PanelMoving +=
        new PenInputPanelMovingEventHandler(PanelMoving_Event);

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

//...

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

        theSenderPanel.AttachedEditControl.Text = "The panel has moved to ";
        theSenderPanel.AttachedEditControl.Text += e.Left.ToString();
        theSenderPanel.AttachedEditControl.Text += ", ";
        theSenderPanel.AttachedEditControl.Text += e.Top.ToString();
    }
}

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。接著會將 PanelMoving 事件處理常式和 VisibleChanged 事件處理常式加入至 thePenInputPanel。在 VisibleChanged 處理常式中,畫筆輸入面板的位置已變更,導致引發 PanelMoving 事件。接著,PanelMoving 處理常式會將所附加 InkEdit 控制項的文字設定為包含畫筆輸入面板的新螢幕座標的句子。

[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 PanelMoving event handler
    AddHandler thePenInputPanel.PanelMoving, _
               AddressOf PanelMoving_Event

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

'...

Public Sub PanelMoving_Event(sender As Object, e As _
                             PenInputPanelMovingEventArgs)
    ' 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)

       theSenderPanel.AttachedEditControl.Text = "The panel has moved to "
       theSenderPanel.AttachedEditControl.Text += e.Left.ToString
       theSenderPanel.AttachedEditControl.Text += ", "
       theSenderPanel.AttachedEditControl.Text += e.Top.ToString
    End If
End Sub 'PanelMoving_Event

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

請參閱

參考

Microsoft.Ink 命名空間

PenInputPanel.OnPanelMoving