DataObject.GetFormats 메서드

정의

DataObject에 저장된 데이터가 관련되어 있거나 변환될 수 있는 모든 형식의 목록을 반환합니다.

오버로드

GetFormats()

DataObject에 저장된 데이터가 관련되어 있거나 변환될 수 있는 모든 형식의 목록을 반환합니다.

GetFormats(Boolean)

자동 변환 매개 변수를 사용하여 네이티브 데이터 형식만 검색할지 아니면 데이터가 변환될 수 있는 모든 형식을 검색할지를 결정하여 이 DataObject에 저장된 데이터가 관련되어 있거나 변환될 수 있는 모든 형식의 목록을 반환합니다.

GetFormats()

DataObject에 저장된 데이터가 관련되어 있거나 변환될 수 있는 모든 형식의 목록을 반환합니다.

public:
 virtual cli::array <System::String ^> ^ GetFormats();
public virtual string[] GetFormats ();
abstract member GetFormats : unit -> string[]
override this.GetFormats : unit -> string[]
Public Overridable Function GetFormats () As String()

반환

String[]

이 개체에 저장된 데이터가 지원하는 모든 형식의 목록을 포함하는 String 형식의 배열입니다.

구현

예제

다음 코드 예제에서는 해당 데이터와 연결된 형식 및 데이터를 변환할 수 있는 형식에 대해 쿼리 DataObject 합니다. 결과 목록이 텍스트 상자에 표시됩니다. 이 코드를 실행 하려면 textBox1 만들었습니다.

private:
   void GetAllFormats()
   {
      // Creates a new data object using a string and the text format.
      DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" );
      
      // Gets all the data formats and data conversion formats in the DataObject.
      array<String^>^ arrayOfFormats = myDataObject->GetFormats();
      
      // Prints the results.
      textBox1->Text = "The format(s) associated with the data are: \n";
      for ( int i = 0; i < arrayOfFormats->Length; i++ )
      {
         textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" );
      }
   }
private void GetAllFormats() {
    // Creates a new data object using a string and the text format.
    DataObject myDataObject = new DataObject(DataFormats.Text, "Another string");
 
    // Gets all the data formats and data conversion formats in the DataObject.
    String[] arrayOfFormats = myDataObject.GetFormats();
 
    // Prints the results.
    textBox1.Text = "The format(s) associated with the data are: " + '\n';
    for(int i=0; i<arrayOfFormats.Length; i++)
       textBox1.Text += arrayOfFormats[i] + '\n';
 }
Private Sub GetAllFormats()
    ' Creates a new data object using a string and the text format.
    Dim myDataObject As New DataObject(DataFormats.Text, "Another string")
    
    ' Gets all the data formats and data conversion formats in the DataObject.
    Dim arrayOfFormats As String() = myDataObject.GetFormats()
    
    ' Prints the results.
    textBox1.Text = "The format(s) associated with the data are: " & ControlChars.Cr
    Dim i As Integer
    For i = 0 To arrayOfFormats.Length - 1
        textBox1.Text += arrayOfFormats(i) & ControlChars.Cr
    Next i
End Sub

설명

호출하기 전에 지원되는 데이터 형식을 얻으려면 이 메서드를 호출 GetData합니다. 미리 정의된 형식을 참조 DataFormats 하세요.

참고

변환이 허용되도록 지정하고 요청된 형식이 저장된 형식과 호환되는 경우 데이터를 다른 형식으로 변환할 수 있습니다. 예를 들어 유니코드로 저장된 데이터를 텍스트로 변환할 수 있습니다.

추가 정보

적용 대상

GetFormats(Boolean)

자동 변환 매개 변수를 사용하여 네이티브 데이터 형식만 검색할지 아니면 데이터가 변환될 수 있는 모든 형식을 검색할지를 결정하여 이 DataObject에 저장된 데이터가 관련되어 있거나 변환될 수 있는 모든 형식의 목록을 반환합니다.

public:
 virtual cli::array <System::String ^> ^ GetFormats(bool autoConvert);
public virtual string[] GetFormats (bool autoConvert);
abstract member GetFormats : bool -> string[]
override this.GetFormats : bool -> string[]
Public Overridable Function GetFormats (autoConvert As Boolean) As String()

매개 변수

autoConvert
Boolean

DataObject에 저장된 데이터가 관련되어 있거나 변환될 수 있는 모든 형식을 검색하려면 true이고, 네이티브 데이터 형식만 검색하려면 false입니다.

반환

String[]

이 개체에 저장된 데이터가 지원하는 모든 형식의 목록을 포함하는 String 형식의 배열입니다.

구현

예제

다음 코드 예제에서는 DataObject 해당 데이터와 연결된 형식을 쿼리합니다. 첫 번째 쿼리는 매개 변수를 autoConvert 지정 false하므로 데이터의 네이티브 형식만 반환됩니다. 두 번째 쿼리는 매개 변수를 autoConvert 형식으로 true지정하므로 형식 목록에는 데이터를 변환할 수 있는 형식이 포함됩니다.

이 코드를 실행 하려면 textBox1 만들었습니다.

private:
   void GetAllFormats2()
   {
      // Creates a new data object using a string and the text format.
      DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" );
      
      // Gets the original data formats in the DataObject.
      array<String^>^ arrayOfFormats = myDataObject->GetFormats( false );
      
      // Prints the results.
      textBox1->Text = "The format(s) associated with the data are: \n";
      for ( int i = 0; i < arrayOfFormats->Length; i++ )
      {
         textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" );
      }
      
      // Gets the all data formats and data conversion formats for the DataObject.
      arrayOfFormats = myDataObject->GetFormats( true );
      
      // Prints the results.
      textBox1->Text = String::Concat( textBox1->Text , "The data formats and conversion ",
         "format(s) associated with the data are: \n" );
      for ( int i = 0; i < arrayOfFormats->Length; i++ )
      {
         textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" );
      }
   }
private void GetAllFormats2() {
    // Creates a new data object using a string and the text format.
    DataObject myDataObject = new DataObject(DataFormats.Text, "Another string");
 
    // Gets the original data formats in the DataObject.
    String[] arrayOfFormats = myDataObject.GetFormats(false);
 
    // Prints the results.
    textBox1.Text = "The format(s) associated with the data are: " + '\n';
    for(int i=0; i<arrayOfFormats.Length; i++)
       textBox1.Text += arrayOfFormats[i] + '\n';
 
    // Gets the all data formats and data conversion formats for the DataObject.
    arrayOfFormats = myDataObject.GetFormats(true);
 
    // Prints the results.
    textBox1.Text += "The data formats and conversion format(s) associated with " +
       "the data are: " + '\n';
    for(int i=0; i<arrayOfFormats.Length; i++)
       textBox1.Text += arrayOfFormats[i] + '\n';
 }
Private Sub GetAllFormats2()
    ' Creates a new data object using a string and the text format.
    Dim myDataObject As New DataObject(DataFormats.Text, "Another string")
    
    ' Gets the original data formats in the DataObject.
    Dim arrayOfFormats As String() = myDataObject.GetFormats(False)
    
    ' Prints the results.
    textBox1.Text = "The format(s) associated with the data are: " & ControlChars.Cr
    Dim i As Integer
    For i = 0 To arrayOfFormats.Length - 1
        textBox1.Text += arrayOfFormats(i) + ControlChars.Cr
    Next i 
    ' Gets the all data formats and data conversion formats for the DataObject.
    arrayOfFormats = myDataObject.GetFormats(True)
    
    ' Prints the results.
    textBox1.Text += "The data formats and conversion format(s) associated with " & _
        "the data are: " & ControlChars.Cr
        
    For i = 0 To arrayOfFormats.Length - 1
        textBox1.Text += arrayOfFormats(i) + ControlChars.Cr
    Next i
End Sub

설명

를 호출하기 전에 이 메서드를 호출 GetData하여 지원되는 데이터 형식을 가져옵니다. 미리 정의된 형식을 참조 DataFormats 하세요.

참고

데이터가 저장되어 변환이 허용되도록 지정하고 요청된 형식이 저장된 형식과 호환되는 경우 다른 형식으로 변환할 수 있습니다. 예를 들어 유니코드로 저장된 데이터를 텍스트로 변환할 수 있습니다.

추가 정보

적용 대상