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

설명

이 필드가 사용 되는 IDataObject 인터페이스 및 DataObject 데이터 형식을 지정 하는 클래스입니다.

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

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

이 형식의 개체를 가져오려는 형식으로 사용 합니다 IDataObject.GetDataDataObject.GetData 메서드.

참고

문자열 클래스 형식을 Windows Forms 관련 되며 Windows Forms 외부에서 생성 하는 애플리케이션에서 인식 되지 않습니다.

적용 대상

추가 정보