|
この記事は機械翻訳されたものです。 記事の文章にポインターを重ねると、原文のテキストが表示されます。 詳細情報
|
訳文
原文
|
DataFormats クラス
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (System.Windows.Forms.dll 内)
DataFormats 型で公開されるメンバーは以下のとおりです。
| 名前 | 説明 | |
|---|---|---|
![]() | Equals(Object) | |
![]() | Finalize | |
![]() ![]() | GetFormat(Int32) | |
![]() ![]() | GetFormat(String) | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | MemberwiseClone | |
![]() | ToString |
| 名前 | 説明 | |
|---|---|---|
![]() ![]() | Bitmap | |
![]() ![]() | CommaSeparatedValue | |
![]() ![]() | Dib | |
![]() ![]() | Dif | |
![]() ![]() | EnhancedMetafile | |
![]() ![]() | FileDrop | |
![]() ![]() | Html | |
![]() ![]() | Locale | |
![]() ![]() | MetafilePict | |
![]() ![]() | OemText | |
![]() ![]() | Palette | |
![]() ![]() | PenData | |
![]() ![]() | Riff | |
![]() ![]() | Rtf | |
![]() ![]() | Serializable | |
![]() ![]() | StringFormat | |
![]() ![]() | SymbolicLink | |
![]() ![]() | Text | |
![]() ![]() | Tiff | |
![]() ![]() | UnicodeText | |
![]() ![]() | WaveAudio |
形式名または ID 番号に対して定義済みの DataFormats.Format オブジェクトを取得します。 ユーザーが形式名を渡すとき、このクラスの static リストに形式名と ID 番号の新しいペアを追加し、Windows レジストリにこの形式を Clipboard 形式として登録します。
using System; using System.Windows.Forms; public class MyClass : Form { protected TextBox textBox1; public void MyClipboardMethod() { // Creates a new data format. DataFormats.Format myFormat = DataFormats.GetFormat("myFormat"); /* Creates a new object and stores it in a DataObject using myFormat * as the type of format. */ MyNewObject myObject = new MyNewObject(); DataObject myDataObject = new DataObject(myFormat.Name, myObject); // Copies myObject into the clipboard. Clipboard.SetDataObject(myDataObject); // Performs some processing steps. // Retrieves the data from the clipboard. IDataObject myRetrievedObject = Clipboard.GetDataObject(); // Converts the IDataObject type to MyNewObject type. MyNewObject myDereferencedObject = (MyNewObject)myRetrievedObject.GetData(myFormat.Name); // Prints the value of the Object in a textBox. textBox1.Text = myDereferencedObject.MyObjectValue; } } // Creates a new type. [Serializable] public class MyNewObject : Object { private string myValue; // Creates a default constructor for the class. public MyNewObject() { myValue = "This is the value of the class"; } // Creates a property to retrieve or set the value. public string MyObjectValue { get { return myValue; } set { myValue = value; } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (サーバー コア ロールはサポート対象外), Windows Server 2008 R2 (SP1 以降でサーバー コア ロールをサポート。Itanium はサポート対象外)
.NET Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
