DataObject.SetText 方法

定义

在此数据对象中存储指定为字符串的文本数据。Stores text data, specified as a string, in this data object.

重载

SetText(String)

在此数据对象中存储指定为字符串的 UnicodeText 数据。Stores UnicodeText data, specified as a string, in this data object.

SetText(String, TextDataFormat)

在此数据对象中存储文本数据。Stores text data in this data object. 使用 TextDataFormat 的成员指定要存储的文本数据的格式。The format of the text data to store is specified with a member of TextDataFormat.

SetText(String)

在此数据对象中存储指定为字符串的 UnicodeText 数据。Stores UnicodeText data, specified as a string, in this data object.

public:
 void SetText(System::String ^ textData);
public void SetText (string textData);
member this.SetText : string -> unit
Public Sub SetText (textData As String)

参数

textData
String

一个字符串,其中包含要存储在数据对象中的 UnicodeText 数据。A string that contains the UnicodeText data to store in the data object.

例外

textDatanulltextData is null.

注解

此数据格式表示16位字符编码的 Unicode,也称为 UTF-16,USC-2。This data format denotes 16-bit character encoded Unicode, also referred to as UTF-16, and USC-2.

此方法在禁用自动转换 (与在 SetData(String, Object, Boolean) autoConvert 设置为) 时调用相同的数据 falseThis method adds data with auto-conversion disabled (the same as calling SetData(String, Object, Boolean) with autoConvert set to false).

另请参阅

适用于

SetText(String, TextDataFormat)

在此数据对象中存储文本数据。Stores text data in this data object. 使用 TextDataFormat 的成员指定要存储的文本数据的格式。The format of the text data to store is specified with a member of TextDataFormat.

public:
 void SetText(System::String ^ textData, System::Windows::TextDataFormat format);
public void SetText (string textData, System.Windows.TextDataFormat format);
member this.SetText : string * System.Windows.TextDataFormat -> unit
Public Sub SetText (textData As String, format As TextDataFormat)

参数

textData
String

一个字符串,其中包含要存储在数据对象中的文本数据。A string that contains the text data to store in the data object.

format
TextDataFormat

指定要存储的文本数据格式的 TextDataFormat 的成员。A member of TextDataFormat that specifies the text data format to store.

例外

textDatanulltextData is null.

注解

此方法在禁用自动转换 (与在 SetData(String, Object, Boolean) autoConvert 设置为) 时调用相同的数据 falseThis method adds data with auto-conversion disabled (the same as calling SetData(String, Object, Boolean) with autoConvert set to false).

另请参阅

适用于