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(R) Visual C#(R) 示例创建 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(R) .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