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-cn,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(R) Visual Basic(R) .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 命名空间