DataFormats.Format(String, Int32) 建構函式

定義

初始化一個新的類別實例 DataFormats.Format ,並使用布林值表示是否預期有 Win32 句柄。

public:
 Format(System::String ^ name, int id);
public Format(string name, int id);
new System.Windows.Forms.DataFormats.Format : string * int -> System.Windows.Forms.DataFormats.Format
Public Sub New (name As String, id As Integer)

參數

name
String

這個格式的名稱。

id
Int32

此格式的識別碼。

範例

以下程式碼範例為名稱與唯一 ID 編號創建了新的格式。 新格式不需要 Windows 帳號。 它需要 已被 textBox1 實例化。

private:
   void CreateMyFormat2()
   {
      DataFormats::Format^ myFormat = gcnew DataFormats::Format(
         "AnotherNewFormat", 20916 );
      
      // Displays the contents of myFormat.
      textBox1->Text = String::Format( "ID value: {0}\nFormat name: {1}",
         myFormat->Id, myFormat->Name );
   }
private void CreateMyFormat2() {
    DataFormats.Format myFormat = new DataFormats.Format("AnotherNewFormat", 20916);
 
    // Displays the contents of myFormat.
    textBox1.Text = "ID value: " + myFormat.Id + '\n' +
       "Format name: " + myFormat.Name;
 }
Private Sub CreateMyFormat2()
    Dim myFormat As New DataFormats.Format("AnotherNewFormat", 20916)
       
    ' Displays the contents of myFormat.
    textBox1.Text = "ID value: " + myFormat.Id.ToString() + ControlChars.Cr _
                  + "Format name: " + myFormat.Name
End Sub

適用於