取得或設定值,這個值指定 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 物件是附加在已知視窗的後面還是前面的值。
值 |
意義 |
|---|---|
預設值。InkOverlay 是附加在已知視窗的後面。筆墨會繪製在子控制項下方。 |
|
InkOverlay 是附加在已知視窗的前面。筆墨會繪製在子控制項上方。 |
備註
注意事項: |
|---|
如果設定這個屬性之前未停用 InkOverlay 物件,就會發生錯誤。若要停用 InkOverlay 物件,請將 Enabled 屬性設定為 false。然後,您就可以設定 InkOverlayAttachMode 屬性,並透過將 Enabled 屬性設定為 true 來重新啟用物件。 |
當 InkOverlay 物件是附加在已知視窗的前面時,如果要在這個物件中重繪筆劃,請呼叫表單的 Invalidate(rect, true) (英文) 多載,它會強制所有子控制項進行重繪。
警告
如果 AttachMode 是設定為 InFront,然後控制項加入至 InkOverlay 的 AttachedControl,則必須重新附加控制項,步驟如下:先將 Enabled 設定為 false,再設定 AttachedControl 屬性,然後將 Enabled 設定為 true。
範例
這個 C# 範例會建立 InkOverlay 物件 (變數名稱為 theInkOverlay),並將它附加至 Windows Form 上的 Panel (英文) (變數名稱為 thePanel)。另外,AttachMode 屬性是用來在位於 Panel 上的 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 Form 上的 Panel (英文) (變數名稱為 thePanel)。另外,AttachMode 屬性是用來在位於 Panel 上的 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
注意事項: