DataFormats.StringFormat Alan

Tanım

Windows Forms dize nesnelerini depolamak için kullandığı Windows Forms dize sınıfı biçimini belirtir. Bu static alan salt okunur.

public: static initonly System::String ^ StringFormat;
public static readonly string StringFormat;
 staticval mutable StringFormat : string
Public Shared ReadOnly StringFormat As String 

Alan Değeri

String

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir.

try
{
   String^ myString = "This is a String from the ClipBoard";
   // Sets the data to the Clipboard.   
   Clipboard::SetDataObject( myString );
   IDataObject^ myDataObject = Clipboard::GetDataObject();
   
   // Checks whether the data is present or not in the Clipboard.
   if ( myDataObject->GetDataPresent( DataFormats::StringFormat ) )
   {
      String^ clipString = (String^)(myDataObject->GetData( DataFormats::StringFormat ));
      Console::WriteLine( clipString );
   }
   else
   {
      Console::WriteLine( "No String information was contained in the clipboard." );
   }
}
catch ( Exception^ e ) 
{
   Console::WriteLine( e->Message );
}
try
{
    String myString = "This is a String from the ClipBoard";
    // Sets the data to the Clipboard.   
    Clipboard.SetDataObject(myString);
    IDataObject myDataObject = Clipboard.GetDataObject();

    // Checks whether the data is present or not in the Clipboard.
    if(myDataObject.GetDataPresent(DataFormats.StringFormat)) 
    {
        String clipString = (String)myDataObject.GetData(DataFormats.StringFormat);
        Console.WriteLine(clipString);
    } 
    else 
    {
        Console.WriteLine("No String information was contained in the clipboard.");
    }
}
catch(Exception e)
{
    Console.WriteLine(e.Message);
}
        Try
            Dim myString As String = "This is a String from the ClipBoard"
            ' Sets the data to the Clipboard.   
            Clipboard.SetDataObject(myString)
            Dim myDataObject As IDataObject = Clipboard.GetDataObject()
          
            ' Checks whether the data is present or not in the Clipboard.
            If myDataObject.GetDataPresent(DataFormats.StringFormat) Then
                Dim clipString As String = CType(myDataObject.GetData(DataFormats.StringFormat), String)
                Console.WriteLine(clipString)
            Else
                Console.WriteLine("No String information was contained in the clipboard.")
            End If
        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
   End Sub
End Class

Açıklamalar

Bu alan, arabirim ve DataObject sınıf tarafından IDataObject veri türünü belirtmek için kullanılır.

uygulamasına IDataObject DataObjectveya eklerken, ve DataObject.SetData yöntemleri için IDataObject.SetData biçim olarak bu alanı kullanın.

Bu tür bir nesnenin var olup olmadığını görmek için, ve DataObject.GetDataPresent yöntemleri için IDataObject.GetDataPresent biçim olarak bu alanı kullanın.

Bu türdeki bir nesneyi almak için IDataObject.GetData , ve DataObject.GetData yöntemlerinin biçimi olarak bunu kullanın.

Not

Dize sınıfı biçimi yalnızca Windows Forms özgüdür ve Windows Forms dışında oluşturulan uygulamalar tarafından tanınmaz.

Şunlara uygulanır

Ayrıca bkz.