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

Ö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 IDataObject sınıf tarafından DataObject veri türünü belirtmek için kullanılır.

bir IDataObject veya uygulamasına DataObjecteklerken ve IDataObject.SetData yöntemleri için DataObject.SetData biçim olarak bu alanı kullanın.

Bu türdeki bir nesnenin var olup olmadığını görmek için IDataObject.GetDataPresent ve DataObject.GetDataPresent yöntemlerinin biçimi 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.

Note

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.