DataFormats.Format DataFormats.Format DataFormats.Format DataFormats.Format Class

定义

表示剪贴板格式类型。Represents a Clipboard format type.

public: ref class DataFormats::Format
public class DataFormats.Format
type DataFormats.Format = class
Public Class DataFormats.Format
继承
DataFormats.FormatDataFormats.FormatDataFormats.FormatDataFormats.Format

示例

下面的代码示例演示如何检索DataFormats.Format表示格式名称/ID 对。The following code example shows how to retrieve a DataFormats.Format representing a format name/ID pair. UnicodeText请求格式,以及检索到的内容DataFormats.Format显示在文本框中。The UnicodeText format is requested, and the contents of the retrieved DataFormats.Format are displayed in a text box.

此代码需要textBox1已创建。This code requires that textBox1 has been created.

private:
   void GetMyFormatInfomation()
   {
      // Creates a DataFormats.Format for the Unicode data format.
      DataFormats::Format^ myFormat = DataFormats::GetFormat(
         DataFormats::UnicodeText );
      
      // Displays the contents of myFormat.
      textBox1->Text = String::Format( "ID value: {0}\nFormat name: {1}",
         myFormat->Id, myFormat->Name );
   }
private void GetMyFormatInfomation() {
   // Creates a DataFormats.Format for the Unicode data format.
   DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.UnicodeText);

   // Displays the contents of myFormat.
   textBox1.Text = "ID value: " + myFormat.Id + '\n' +
      "Format name: " + myFormat.Name;
}

Private Sub GetMyFormatInfomation()
    ' Creates a DataFormats.Format for the Unicode data format.
    Dim myFormat As DataFormats.Format = _
       DataFormats.GetFormat(DataFormats.UnicodeText)
       
    ' Displays the contents of myFormat.
    textBox1.Text = "ID value: " + myFormat.Id.ToString() + ControlChars.Cr _
                  + "Format name: " + myFormat.Name
End Sub

注解

格式类型组成的基于文本的格式名称和 ID 号。A format type consists of a text-based format name and an ID number. 格式名称/ID 编号对可以定义一个系统Clipboard或其他格式。The format name/ID number pair can define a system Clipboard or other format.

构造函数

DataFormats.Format(String, Int32) DataFormats.Format(String, Int32) DataFormats.Format(String, Int32) DataFormats.Format(String, Int32)

用一个布尔值对 DataFormats.Format 类的新实例进行初始化,此布尔值指示是否需要 Win32 句柄。Initializes a new instance of the DataFormats.Format class with a Boolean that indicates whether a Win32 handle is expected.

属性

Id Id Id Id

获取此格式的 ID 号。Gets the ID number for this format.

Name Name Name Name

获取该格式的名称。Gets the name of this format.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

适用于

另请参阅