DataFormats.Format 类

表示剪贴板格式类型。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Class Format
用法
Dim instance As Format
public class Format
public ref class Format
public class Format
public class Format

备注

格式类型由基于文字的格式名称和 ID 号构成。格式名/ID 号对可以定义系统 Clipboard 或其他格式。

示例

下面的代码示例演示如何检索表示一个格式名称/ID 对的 DataFormats.Format。将请求 UnicodeText 格式,并将检索到的 DataFormats.Format 的内容显示在一个文本框中。

此代码要求已创建 textBox1

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
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:
   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.set_Text("ID value: "
        + myFormat.get_Id() + '\n' + "Format name: " + myFormat.get_Name());
} //GetMyFormatInfomation

继承层次结构

System.Object
  System.Windows.Forms.DataFormats.Format

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

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

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

DataFormats.Format 成员
System.Windows.Forms 命名空间
Clipboard 类
DataFormats 类
DataObject
IDataObject