Share via


InkOverlay.AttachMode 属性

获取或设置指定 InkOverlay 对象是附加到已知窗口的后方还是前方的值。

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

语法

声明
<BrowsableAttribute(True)> _
Public Property AttachMode As InkOverlayAttachMode
用法
Dim instance As InkOverlay
Dim value As InkOverlayAttachMode

value = instance.AttachMode

instance.AttachMode = value
[BrowsableAttribute(true)]
public InkOverlayAttachMode AttachMode { get; set; }
[BrowsableAttribute(true)]
public:
property InkOverlayAttachMode AttachMode {
    InkOverlayAttachMode get ();
    void set (InkOverlayAttachMode value);
}
/** @property */
/** @attribute BrowsableAttribute(true) */
public InkOverlayAttachMode get_AttachMode()
/** @property */
/** @attribute BrowsableAttribute(true) */
public  void set_AttachMode(InkOverlayAttachMode value)
public function get AttachMode () : InkOverlayAttachMode
public function set AttachMode (value : InkOverlayAttachMode)

属性值

类型:Microsoft.Ink.InkOverlayAttachMode
指定 InkOverlay 对象是附加到已知窗口的后方还是前方的值。

含义

Behind

默认值。InkOverlay 附加到已知窗口的后方。墨迹 在子控件之下进行绘制。

InFront

InkOverlay 附加到已知窗口的前方。墨迹 在子控件之上进行绘制。

备注

备注

如果在设置此属性之前未禁用 InkOverlay 对象,则会发生错误。若要禁用 InkOverlay 对象,请将 Enabled 属性设置为 false。然后,可以设置 InkOverlayAttachMode 属性,并通过将 Enabled 属性设置为 true 以重新启用该对象。

若要在 InkOverlay 对象附加到已知窗口前方时重新绘制其中的笔画,请调用窗体的 Invalidate(rect, true) 重载,该重载强制重新绘制所有子控件。

警告

如果将 AttachMode 设置为 InFront,然后将一个控件添加到 InkOverlayAttachedControl,则必须重新附加该控件。先将 Enabled 设置为 false,然后设置 AttachedControl 属性,再将 Enabled 设置为 true。

示例

此 C# 示例创建 InkOverlay 对象 theInkOverlay,并将其附加到 Windows 窗体上的一个 Panel (thePanel)。然后,AttachMode 属性用于启用和禁用面板上的一个 Label 控件 theLabel 之上的墨迹书写。

using System;
using System.Windows.Forms;
using Microsoft.Ink;


public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel thePanel;
  private System.Windows.Forms.CheckBox theCheckBox;
  private System.Windows.Forms.Label theLabel;  
  private Microsoft.Ink.InkOverlay theInkOverlay;

  // Windows Form Designer generated code
  // . . .

  public Form1()
  {
    theInkOverlay = new Microsoft.Ink.InkOverlay();
    theInkOverlay.Handle = thePanel.Handle;
    theInkOverlay.Enabled = true;  
  }

  // Toggle AttachMode between InFront and Behind.
  private void theCheckBox_CheckedChanged(object sender, System.EventArgs e)
  {
    theInkOverlay.Enabled = false;
    if (theInkOverlay.AttachMode == InkOverlayAttachMode.InFront)
    {
      theInkOverlay.AttachMode = InkOverlayAttachMode.Behind;
    }
    else
    {
      theInkOverlay.AttachMode = InkOverlayAttachMode.InFront;
    }
    theInkOverlay.Enabled = true;
  }

}
      

此 Microsoft Visual Basic .NET 示例创建 InkOverlay 对象 theInkOverlay,并将其附加到 Windows 窗体上的一个 Panel(thePanel。然后,AttachMode 属性用于启用和禁用面板上的一个 Label 控件 theLabel 之上的墨迹书写。

Imports Microsoft.Ink
      
Public Class Form1
    Inherits System.Windows.Forms.Form

    'Windows Form Designer generated code 
    '. . .

    Private WithEvents theInkOverlay As Microsoft.Ink.InkOverlay
    Friend WithEvents thePanel As System.Windows.Forms.Panel
    Friend WithEvents theCheckBox As System.Windows.Forms.CheckBox

  Public Sub New()
        MyBase.New()

        theInkOverlay = New Microsoft.Ink.InkOverlay()
        theInkOverlay.Handle = thePanel.Handle
        theInkOverlay.Enabled = True
    End Sub
  
'. . .

    Private Sub theCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles theCheckBox.CheckedChanged
        theInkOverlay.Enabled = False

        If theInkOverlay.AttachMode = InkOverlayAttachMode.Behind Then
            theInkOverlay.AttachMode = InkOverlayAttachMode.InFront
        Else
            theInkOverlay.AttachMode = InkOverlayAttachMode.Behind
        End If

        theInkOverlay.Enabled = True
    End Sub
End Class

      

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkOverlay 类

InkOverlay 成员

Microsoft.Ink 命名空间