PenInputPanel.Left 属性

已否决。获取 PenInputPanel 对象的左边缘的水平(即 x 轴)位置(以屏幕坐标表示)。PenInputPanel 已由 Microsoft.Ink.TextInput 替换。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public ReadOnly Property Left As Integer
用法
Dim instance As PenInputPanel
Dim value As Integer

value = instance.Left
public int Left { get; }
public:
property int Left {
    int get ();
}
/** @property */
public int get_Left()
public function get Left () : int

属性值

类型:System.Int32
PenInputPanel 对象左边缘的水平(即 x 轴)位置(以屏幕坐标表示)。

备注

若要显式重写 PenInputPanel 对象的自动定位行为,可以使用该对象的 Left 和 Top 属性确定笔输入面板的当前位置。

通过在 PanelMoving 事件期间侦听 PenInputPanelMovingEventArgs 对象的 LeftTop 属性,还可以重写 PenInputPanel 对象的自动定位行为。

ms571981.alert_security(zh-cn,VS.90).gif安全说明:

如果在部分信任环境下使用,则除了 PenInputPanel 所需的权限以外,该属性还需要 SecurityPermissionFlag.AllFlags 权限。有关更多信息,请参见Security and Trust

示例

此 C# 示例创建 PenInputPanel 对象 thePenInputPanel,并将它附加到 InkEdit 控件 theInkEdit。然后,它附加 VisibleChanged 事件处理程序 VisibleChanged_Event。该事件处理程序使用 Left 属性将一个句子添加到 theInkEdit 的内容中,用以描述 PenInputPanel 对象左边缘的位置(以屏幕坐标表示)。

[C#]

//...

// Declare 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 VisibleChanged 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;

        // When the panel has become visible...
        if (e.NewVisibility)
        {
            // Display the left edge of the
            // panel in the attached edit control
            theSenderPanel.AttachedEditControl.Text +=
                    "The left edge of the panel is at ";
            theSenderPanel.AttachedEditControl.Text += theSenderPanel.Left.ToString();
            theSenderPanel.AttachedEditControl.Text += " pixels.\n";
        }
    }
}

此 Microsoft(R) Visual Basic(R) .NET 示例创建 PenInputPanel 对象 thePenInputPanel,并将它附加到 InkEdit 控件 theInkEdit。然后,它附加 VisibleChanged 事件处理程序 VisibleChanged_Event。该事件处理程序使用 Left 属性将一个句子添加到 theInkEdit 的内容中,用以描述 PenInputPanel 对象左边缘的位置(以屏幕坐标表示)。

[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 VisibleChanged 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)

       ' When the panel has become visible...
       If e.NewVisibility Then
           ' Display the left edge of the
           ' panel in the attached edit control
           theSenderPanel.AttachedEditControl.Text += _
                    "The left edge of the panel is at "
          theSenderPanel.AttachedEditControl.Text += _
                   theSenderPanel.Left.ToString()
          theSenderPanel.AttachedEditControl.Text += _
                   " pixels." + ControlChars.Lf
       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 命名空间

PenInputPanel.Top