DataFormats.StringFormat フィールド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


このフィールドは、データ型を指定するために、IDataObject インターフェイスと DataObject クラスで使用されます。
IDataObject または DataObject の実装に追加する場合は、IDataObject.SetData メソッドと DataObject.SetData メソッドの形式として、このフィールドを使用します。
この型のオブジェクトが存在するかどうかを確認するには、IDataObject.GetDataPresent メソッドと DataObject.GetDataPresent メソッドの形式として、このフィールドを使用します。
この型のオブジェクトを取得するには、IDataObject.GetData メソッドと DataObject.GetData メソッドの形式として、このフィールドを使用します。
![]() |
---|
文字列クラス形式は Windows フォーム固有の形式であり、Windows フォーム以外で作成されたアプリケーションでは認識できません。 |

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 'Main End Class 'DataFormats_StringFormat
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 { 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 (System.Exception e) { Console.WriteLine(e.get_Message()); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataFormats クラス
DataFormats メンバ
System.Windows.Forms 名前空間
GetData
SetData
GetDataPresent
GetFormats
DataObject
IDataObject
GetFormat
DataFormats.Format.Name
DataFormats.Format.Id
- DataFormats.StringFormat フィールドのページへのリンク