TextElementEditingBehaviorAttribute 類別

定義

指定 RichTextBox 應如何處理自訂文字項目。

public ref class TextElementEditingBehaviorAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class TextElementEditingBehaviorAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type TextElementEditingBehaviorAttribute = class
    inherit Attribute
Public NotInheritable Class TextElementEditingBehaviorAttribute
Inherits Attribute
繼承
TextElementEditingBehaviorAttribute
屬性

備註

當您建立自訂文字專案時,可以使用 TextElementEditingBehaviorAttribute 屬性來指定元素應該視為單一且無法中斷的實體。 IsMergeable當 和 IsTypographicOnly 屬性設定為 false 時,當使用者編輯 RichTextBox 時,會 RichTextBox 保留元素的界限和內容。 一般而言,自訂專案的行為類似于 Hyperlink 。 當您使用此類別,並將其兩個屬性設定為 false 時,就會發生下列行為:

  • 當使用者複製並貼上自訂元素中內容的一部分時,不會保留複製文字的格式。

  • 當使用者在自訂元素內容之前或之後輸入時,新內容不會取得自訂元素的格式資訊。

  • 使用者無法在自訂專案中插入分行符號。

當您建立自訂專案時,請使用 TextRange.Save(Stream, String, Boolean) 方法並將 設定 preserveTextElementstrue ,以在序列化為磁片或剪貼簿時保留自訂專案和屬性值。

TextElementEditingBehaviorAttribute.NET Framework 3.5 版引進。 如需詳細資訊,請參閱版本和相依性

建構函式

TextElementEditingBehaviorAttribute()

初始化 TextElementEditingBehaviorAttribute 類別的新執行個體。

屬性

IsMergeable

取得或設定值,這個值表示 RichTextBox 是否會合併兩個相鄰的文字項目。

IsTypographicOnly

取得或設定值,這個值表示文字項目會以字元為基礎來提供格式化,還是在整個項目上套用格式化。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

(繼承來源 Attribute)
GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Attribute)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

明確介面實作

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。

(繼承來源 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

擷取物件的類型資訊,可以用來取得介面的類型資訊。

(繼承來源 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

擷取物件提供的類型資訊介面數目 (0 或 1)。

(繼承來源 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供物件所公開的屬性和方法的存取權。

(繼承來源 Attribute)

適用於