Język

DataFormats.Format(String, Int32) Konstruktor

Definicja

Inicjuje nowe wystąpienie DataFormats.Format klasy z wartością logiczną wskazującą, czy uchwyt jest oczekiwany 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)

Parametry

name
String

Nazwa tego formatu.

id
Int32

Numer identyfikatora dla tego formatu.

Przykłady

Poniższy przykład kodu tworzy nowy format nazwy i unikatowego numeru identyfikatora. Nowy format nie wymaga uchwytu Windows. Wymaga textBox1 to utworzenia wystąpienia.

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

Dotyczy