PenInputPanel.PanelMoving 事件
已取代。在 PenInputPanel 物件移動時發生。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Event PanelMoving As PenInputPanelMovingEventHandler
'用途
Dim instance As PenInputPanel
Dim handler As PenInputPanelMovingEventHandler
AddHandler instance.PanelMoving, handler
public event PenInputPanelMovingEventHandler PanelMoving
public:
event PenInputPanelMovingEventHandler^ PanelMoving {
void add (PenInputPanelMovingEventHandler^ value);
void remove (PenInputPanelMovingEventHandler^ value);
}
/** @event */
public void add_PanelMoving (PenInputPanelMovingEventHandler value)
/** @event */
public void remove_PanelMoving (PenInputPanelMovingEventHandler value)
JScript 不支援事件。
備註
事件處理常式會收到 PenInputPanelMovingEventArgs 型別的引數,其中包含這個事件的相關資料。
使用 PanelMoving 事件透過變更 PenInputPanelMovingEventArgs 物件之 Left 和 Top 成員的方式,改變 PenInputPanel 物件的位置。
警告
MoveTo 和 Refresh 方法會造成 PenInputPanel 物件呼叫其自動定位程式碼,該程式碼會觸發 PanelMoving 事件。因此,在 PanelMoving 處理常式內呼叫這些方法可能導致無窮迴圈。
安全性注意事項: |
---|
如果在部分信任的情況下使用,除了 PenInputPanel 所需的權限之外,這個事件還需要 SecurityPermissionFlag.AllFlags (英文) 權限。如需詳細資訊,請參閱Security and Trust。 |
範例
這個 Microsoft® Visual 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