DataFormats.StringFormat 필드

정의

Windows Forms 문자열 개체를 저장하는 데 사용하는 Windows Forms 문자열 클래스 형식을 지정합니다. 이 static 필드는 읽기 전용입니다.

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

필드 값

예제

다음 코드 예제에서는이 멤버의 사용을 보여 줍니다.

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

설명

이 필드는 인터페이스와 클래스에서 IDataObjectDataObject 데이터 형식을 지정하는 데 사용됩니다.

구현에 IDataObject 추가하거나 구현DataObject하는 경우 이 필드를 및 IDataObject.SetData 메서드의 DataObject.SetData 형식으로 사용합니다.

이 형식의 개체가 있는지 확인하려면 이 필드를 및 IDataObject.GetDataPresent 메서드의 DataObject.GetDataPresent 형식으로 사용합니다.

이 형식의 개체를 얻으려면 이 형식을 및 IDataObject.GetData 메서드의 DataObject.GetData 형식으로 사용합니다.

메모

문자열 클래스 형식은 Windows Forms 전용이며 Windows Forms 외부에서 만든 애플리케이션에서 인식되지 않습니다.

적용 대상

추가 정보