479 references to DataFormats
Microsoft.VisualBasic.Tests (8)
Microsoft\VisualBasic\MyServices\ClipboardProxyTests.cs (8)
10using DataFormats = System.Windows.Forms.DataFormats; 47clipboard.SetData(DataFormats.UnicodeText, data); 48clipboard.ContainsData(DataFormats.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.ContainsData(DataFormats.UnicodeText)); 49clipboard.GetData(DataFormats.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.GetData(DataFormats.UnicodeText)); 58clipboard.GetDataObject().GetData(DataFormats.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.GetDataObject()?.GetData(DataFormats.UnicodeText));
System.Windows.Forms (56)
GlobalUsings.cs (1)
9global using DragDropHelper = System.Private.Windows.Ole.DragDropHelper<System.Windows.Forms.Ole.WinFormsOleServices, System.Windows.Forms.DataFormats.Format>;
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (7)
7135DataFormats.Html, 7136DataFormats.Text, 7137DataFormats.UnicodeText, 7138DataFormats.CommaSeparatedValue 7423if (string.Equals(format, DataFormats.Html, StringComparison.OrdinalIgnoreCase)) 7722if (string.Equals(format, DataFormats.Html, StringComparison.OrdinalIgnoreCase)) 8138if (string.Equals(format, DataFormats.Html, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (4)
1316if (string.Equals(format, DataFormats.Html, StringComparison.OrdinalIgnoreCase)) 1353bool csv = string.Equals(format, DataFormats.CommaSeparatedValue, StringComparison.OrdinalIgnoreCase); 1355string.Equals(format, DataFormats.Text, StringComparison.OrdinalIgnoreCase) || 1356string.Equals(format, DataFormats.UnicodeText, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (4)
138if (string.Equals(format, DataFormats.Html, StringComparison.OrdinalIgnoreCase)) 171bool csv = string.Equals(format, DataFormats.CommaSeparatedValue, StringComparison.OrdinalIgnoreCase); 173string.Equals(format, DataFormats.Text, StringComparison.OrdinalIgnoreCase) || 174string.Equals(format, DataFormats.UnicodeText, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (4)
108if (string.Equals(format, DataFormats.Html, StringComparison.OrdinalIgnoreCase)) 143bool csv = string.Equals(format, DataFormats.CommaSeparatedValue, StringComparison.OrdinalIgnoreCase); 145string.Equals(format, DataFormats.Text, StringComparison.OrdinalIgnoreCase) || 146string.Equals(format, DataFormats.UnicodeText, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (2)
1606public bool CanPaste(DataFormats.Format clipFormat) 2587public void Paste(DataFormats.Format clipFormat)
System\Windows\Forms\OLE\Clipboard.cs (18)
159/// Indicates whether there is data on the Clipboard in the <see cref="DataFormats.WaveAudio"/> format. 174/// Indicates whether there is data on the Clipboard that is in the <see cref="DataFormats.FileDrop"/> format 177public static bool ContainsFileDropList() => ContainsData(DataFormats.FileDrop, autoConvert: true); 180/// Indicates whether there is data on the Clipboard that is in the <see cref="DataFormats.Bitmap"/> format 183public static bool ContainsImage() => ContainsData(DataFormats.Bitmap, autoConvert: true); 237/// The format of the data to retrieve. See the <see cref="DataFormats"/> class for a set of predefined data formats. 419public static Image? GetImage() => GetTypedDataIfAvailable<Image>(DataFormats.Bitmap); 454/// Clears the <see cref="Clipboard"/> and then adds data in the <see cref="DataFormats.WaveAudio"/> format. 459/// Clears the <see cref="Clipboard"/> and then adds data in the <see cref="DataFormats.WaveAudio"/> format. 499/// and you are using a custom format or <see cref="DataFormats.Serializable"/>, 539/// Clears the Clipboard and then adds a collection of file names in the <see cref="DataFormats.FileDrop"/> format. 565/// Clears the Clipboard and then adds an <see cref="Image"/> in the <see cref="DataFormats.Bitmap"/> format. 588TextDataFormat.Text => DataFormats.Text, 589TextDataFormat.UnicodeText => DataFormats.UnicodeText, 590TextDataFormat.Rtf => DataFormats.Rtf, 591TextDataFormat.Html => DataFormats.Html, 592TextDataFormat.CommaSeparatedValue => DataFormats.CommaSeparatedValue, 593_ => DataFormats.UnicodeText,
System\Windows\Forms\OLE\DataObject.cs (11)
32private readonly Composition<WinFormsRuntime, DataFormats.Format> _innerData; 39internal DataObject(Com.IDataObject* data) => _innerData = Composition<WinFormsRuntime, DataFormats.Format>.CreateFromNativeDataObject(data); 45public DataObject() => _innerData = Composition<WinFormsRuntime, DataFormats.Format>.CreateFromManagedDataObject(new DataStore()); 63_innerData = Composition<WinFormsRuntime, DataFormats.Format>.CreateFromManagedDataObject(internalDataObject); 67_innerData = Composition<WinFormsRuntime, DataFormats.Format>.CreateFromManagedDataObject(new DataObjectAdapter(iDataObject)); 71_innerData = Composition<WinFormsRuntime, DataFormats.Format>.CreateFromRuntimeDataObject(comDataObject); 75_innerData = Composition<WinFormsRuntime, DataFormats.Format>.CreateFromManagedDataObject(new DataStore()); 113/// <param name="format">The format associated with the data. See <see cref="DataFormats"/> for predefined formats.</param> 124/// and you are using a custom format or <see cref="DataFormats.Serializable"/> 281public virtual Stream? GetAudioStream() => GetData(DataFormats.WaveAudio, autoConvert: false) as Stream; 294public virtual Image? GetImage() => GetData(DataFormats.Bitmap, autoConvert: true) as Image;
System\Windows\Forms\OLE\DataObject.DataStore.cs (4)
95if (data is Bitmap && format.Equals(DataFormats.Dib)) 97format = autoConvert ? DataFormats.Bitmap : throw new NotSupportedException(SR.DataObjectDibNotSupported); 116&& !_mappedData.ContainsKey(DataFormats.Serializable)) 118SetData(DataFormats.Serializable, data);
System\Windows\Forms\WinFormsRuntime.cs (1)
12internal class WinFormsRuntime : Runtime<DataFormats.Format, WinFormsNrbfSerializer, WinFormsOleServices>
System.Windows.Forms.Design (1)
System\Windows\Forms\Design\OleDragDropHandler.ComponentDataObject.cs (1)
203return [NestedToolboxItemFormat, DataFormat, DataFormats.Serializable, ExtraInfoFormat];
System.Windows.Forms.Tests (371)
System\Windows\Forms\ClipboardTests.cs (18)
172Clipboard.GetData(DataFormats.WaveAudio).Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes); 174Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 184Clipboard.GetData(DataFormats.WaveAudio).Should().BeNull(); 186Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 204Clipboard.GetData(DataFormats.WaveAudio).Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes); 206Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 216Clipboard.GetData(DataFormats.WaveAudio).Should().BeNull(); 218Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 659dataObject.GetData(DataFormats.Text).Should().Be(testString); 662Clipboard.ContainsData(DataFormats.Text).Should().BeTrue(); 663Clipboard.ContainsData(DataFormats.UnicodeText).Should().BeTrue(); 1027cfFormat = (short)DataFormats.GetFormat("testFormat").Id, 1192Clipboard.ContainsData(DataFormats.Text).Should().BeTrue(); 1193Clipboard.ContainsData(DataFormats.UnicodeText).Should().BeTrue(); 1218Clipboard.ContainsData(DataFormats.Text).Should().BeTrue(); 1219Clipboard.ContainsData(DataFormats.UnicodeText).Should().BeTrue(); 1247Clipboard.ContainsData(DataFormats.Text).Should().BeTrue(); 1248Clipboard.ContainsData(DataFormats.UnicodeText).Should().BeTrue();
System\Windows\Forms\DataFormatsTests.ClipboardTests.cs (3)
25DataFormats.Format result = DataFormats.GetFormat(id); 26Assert.Equal(result, DataFormats.GetFormat(id));
System\Windows\Forms\DataFormatsTests.cs (58)
13yield return new object[] { DataFormats.Bitmap, "Bitmap" }; 14yield return new object[] { DataFormats.CommaSeparatedValue, "Csv" }; 15yield return new object[] { DataFormats.Dib, "DeviceIndependentBitmap" }; 16yield return new object[] { DataFormats.Dif, "DataInterchangeFormat" }; 17yield return new object[] { DataFormats.EnhancedMetafile, "EnhancedMetafile" }; 18yield return new object[] { DataFormats.FileDrop, "FileDrop" }; 19yield return new object[] { DataFormats.Html, "HTML Format" }; 20yield return new object[] { DataFormats.Locale, "Locale" }; 21yield return new object[] { DataFormats.MetafilePict, "MetaFilePict" }; 22yield return new object[] { DataFormats.OemText, "OEMText" }; 23yield return new object[] { DataFormats.Palette, "Palette" }; 24yield return new object[] { DataFormats.PenData, "PenData" }; 25yield return new object[] { DataFormats.Riff, "RiffAudio" }; 26yield return new object[] { DataFormats.Rtf, "Rich Text Format" }; 27yield return new object[] { DataFormats.Serializable, "WindowsForms10PersistentObject" }; 28yield return new object[] { DataFormats.StringFormat, "System.String" }; 29yield return new object[] { DataFormats.SymbolicLink, "SymbolicLink" }; 30yield return new object[] { DataFormats.Text, "Text" }; 31yield return new object[] { DataFormats.Tiff, "TaggedImageFileFormat" }; 32yield return new object[] { DataFormats.UnicodeText, "UnicodeText" }; 33yield return new object[] { DataFormats.WaveAudio, "WaveAudio" }; 45yield return new object[] { DataFormats.Bitmap, "Bitmap", 2 }; 46yield return new object[] { DataFormats.Dib, "DeviceIndependentBitmap", 8 }; 47yield return new object[] { DataFormats.Dif, "DataInterchangeFormat", 5 }; 48yield return new object[] { DataFormats.EnhancedMetafile, "EnhancedMetafile", 14 }; 49yield return new object[] { DataFormats.FileDrop, "FileDrop", 15 }; 50yield return new object[] { DataFormats.Locale, "Locale", 16 }; 51yield return new object[] { DataFormats.MetafilePict, "MetaFilePict", 3 }; 52yield return new object[] { DataFormats.OemText, "OEMText", 7 }; 53yield return new object[] { DataFormats.Palette, "Palette", 9 }; 54yield return new object[] { DataFormats.PenData, "PenData", 10 }; 55yield return new object[] { DataFormats.Riff, "RiffAudio", 11 }; 56yield return new object[] { DataFormats.SymbolicLink, "SymbolicLink", 4 }; 57yield return new object[] { DataFormats.Text, "Text", 1 }; 58yield return new object[] { DataFormats.Tiff, "TaggedImageFileFormat", 6 }; 59yield return new object[] { DataFormats.UnicodeText, "UnicodeText", 13 }; 60yield return new object[] { DataFormats.WaveAudio, "WaveAudio", 12 }; 67DataFormats.Format result = DataFormats.GetFormat(format); 68Assert.Same(result, DataFormats.GetFormat(format.ToLowerInvariant())); 73Assert.Same(result, DataFormats.GetFormat(format)); 78yield return new object[] { DataFormats.CommaSeparatedValue, "Csv" }; 79yield return new object[] { DataFormats.Html, "HTML Format" }; 80yield return new object[] { DataFormats.Rtf, "Rich Text Format" }; 81yield return new object[] { DataFormats.Serializable, "WindowsForms10PersistentObject" }; 82yield return new object[] { DataFormats.StringFormat, "System.String" }; 90DataFormats.Format result = DataFormats.GetFormat(format); 91Assert.Same(result, DataFormats.GetFormat(format)); 92Assert.Same(result, DataFormats.GetFormat(format.ToLowerInvariant())); 102Assert.Same(result, DataFormats.GetFormat(result.Id)); 108Assert.Throws<ArgumentException>("format", () => DataFormats.GetFormat("")); 109Assert.Throws<ArgumentNullException>("format", () => DataFormats.GetFormat(null)); 121Assert.Throws<Win32Exception>(() => DataFormats.GetFormat(format)); 152DataFormats.Format result = DataFormats.GetFormat(id); 153Assert.Equal(result, DataFormats.GetFormat(id)); 164var format = new DataFormats.Format(name, id);
System\Windows\Forms\DataObjectExtensionsTests.cs (14)
20Action tryGetData2 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!, DataFormats.Text, out _); 22Action tryGetData3 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!, DataFormats.Dib, autoConvert: true, out _); 24Action tryGetData4 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!, DataFormats.EnhancedMetafile, autoConvert: false, out _); 26Action tryGetData5 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!, DataFormats.UnicodeText, Resolver, autoConvert: true, out _); 28Action tryGetData6 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!, DataFormats.Serializable, Resolver, autoConvert: false, out _); 47Action tryGetData = () => dataObject.TryGetData<string>(DataFormats.Text, out _); 57Action tryGetData = () => dataObject.TryGetData<string>(DataFormats.CommaSeparatedValue, autoConvert, out _); 67Action tryGetData = () => dataObject.TryGetData<string>(DataFormats.UnicodeText, Resolver, autoConvert, out _); 84dataObject.TryGetData(DataFormats.Dib, out Bitmap? bitmap).Should().BeFalse(); 93dataObject.TryGetData(DataFormats.Serializable, autoConvert, out Font? font).Should().BeFalse(); 102dataObject.TryGetData(DataFormats.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse(); 118dataObject.TryGetData(DataFormats.Dib, out Bitmap? _).Should().BeFalse(); 127dataObject.TryGetData(DataFormats.FileDrop, autoConvert, out int? _).Should().BeFalse(); 136dataObject.TryGetData(DataFormats.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse();
System\Windows\Forms\DataObjectTests.ClipboardTests.cs (22)
89theoryData.Add(format, null, format == DataFormats.FileDrop, format == DataFormats.Bitmap); 90theoryData.Add(format, "input", format == DataFormats.FileDrop, format == DataFormats.Bitmap); 120dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); 123dataObject.ContainsText().Should().Be(format == DataFormats.UnicodeText); 124dataObject.ContainsText(TextDataFormat.Text).Should().Be(format == DataFormats.UnicodeText); 125dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format == DataFormats.UnicodeText); 126dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format == DataFormats.Rtf); 127dataObject.ContainsText(TextDataFormat.Html).Should().Be(format == DataFormats.Html); 128dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue); 144theoryData.Add(format, autoConvert, null, format == DataFormats.FileDrop, format == DataFormats.Bitmap); 145theoryData.Add(format, autoConvert, "input", format == DataFormats.FileDrop, format == DataFormats.Bitmap); 180dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); 183dataObject.ContainsText().Should().Be(format == DataFormats.UnicodeText); 184dataObject.ContainsText(TextDataFormat.Text).Should().Be(format == DataFormats.UnicodeText); 185dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format == DataFormats.UnicodeText); 186dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format == DataFormats.Rtf); 187dataObject.ContainsText(TextDataFormat.Html).Should().Be(format == DataFormats.Html); 188dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
System\Windows\Forms\DataObjectTests.cs (242)
31DataFormats.CommaSeparatedValue, 32DataFormats.Dib, 33DataFormats.Dif, 34DataFormats.PenData, 35DataFormats.Riff, 36DataFormats.Tiff, 37DataFormats.WaveAudio, 38DataFormats.SymbolicLink, 39DataFormats.StringFormat, 40DataFormats.Bitmap, 41DataFormats.EnhancedMetafile, 42DataFormats.FileDrop, 43DataFormats.Html, 44DataFormats.MetafilePict, 45DataFormats.OemText, 46DataFormats.Palette, 47DataFormats.Rtf, 48DataFormats.Text, 49DataFormats.UnicodeText, 60DataFormats.Serializable, 80.Setup(o => o.GetDataPresent(DataFormats.WaveAudio, false)) 84mockDataObject.Verify(o => o.GetDataPresent(DataFormats.WaveAudio, false), Times.Once()); 103.Setup(o => o.GetDataPresent(DataFormats.FileDrop, true)) 107mockDataObject.Verify(o => o.GetDataPresent(DataFormats.FileDrop, true), Times.Once()); 126.Setup(o => o.GetDataPresent(DataFormats.Bitmap, true)) 130mockDataObject.Verify(o => o.GetDataPresent(DataFormats.Bitmap, true), Times.Once()); 169theoryData.Add(TextDataFormat.Text, DataFormats.UnicodeText, result); 170theoryData.Add(TextDataFormat.UnicodeText, DataFormats.UnicodeText, result); 171theoryData.Add(TextDataFormat.Rtf, DataFormats.Rtf, result); 172theoryData.Add(TextDataFormat.Html, DataFormats.Html, result); 173theoryData.Add(TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue, result); 228dataObject.SetData(DataFormats.WaveAudio, result); 241.Setup(o => o.GetData(DataFormats.WaveAudio, false)) 245mockDataObject.Verify(o => o.GetData(DataFormats.WaveAudio, false), Times.Once()); 435DataFormats.CommaSeparatedValue, 467string format = DataFormats.Bitmap; 480string format = DataFormats.Bitmap; 493{ DataFormats.CommaSeparatedValue, true }, 495{ DataFormats.CommaSeparatedValue, false }, 530string format = DataFormats.Bitmap; 568string format = DataFormats.Bitmap; 581string format = DataFormats.Bitmap; 737dataObject.SetData(DataFormats.FileDrop, result); 750.Setup(o => o.GetData(DataFormats.FileDrop, true)) 754mockDataObject.Verify(o => o.GetData(DataFormats.FileDrop, true), Times.Once()); 907dataObject.SetData(DataFormats.Bitmap, result); 920.Setup(o => o.GetData(DataFormats.Bitmap, true)) 924mockDataObject.Verify(o => o.GetData(DataFormats.Bitmap, true), Times.Once()); 947dataObject.SetData(DataFormats.UnicodeText, result); 977{ TextDataFormat.Text, DataFormats.UnicodeText, null, string.Empty }, 978{ TextDataFormat.Text, DataFormats.UnicodeText, new(), string.Empty }, 979{ TextDataFormat.Text, DataFormats.UnicodeText, string.Empty, string.Empty }, 980{ TextDataFormat.Text, DataFormats.UnicodeText, " ", " " }, 981{ TextDataFormat.Text, DataFormats.UnicodeText, "a", "a" }, 983{ TextDataFormat.UnicodeText, DataFormats.UnicodeText, null, string.Empty }, 984{ TextDataFormat.UnicodeText, DataFormats.UnicodeText, new(), string.Empty }, 985{ TextDataFormat.UnicodeText, DataFormats.UnicodeText, string.Empty, string.Empty }, 986{ TextDataFormat.UnicodeText, DataFormats.UnicodeText, " ", " " }, 987{ TextDataFormat.UnicodeText, DataFormats.UnicodeText, "a", "a" }, 989{ TextDataFormat.Rtf, DataFormats.Rtf, null, string.Empty }, 990{ TextDataFormat.Rtf, DataFormats.Rtf, new(), string.Empty }, 991{ TextDataFormat.Rtf, DataFormats.Rtf, string.Empty, string.Empty }, 992{ TextDataFormat.Rtf, DataFormats.Rtf, " ", " " }, 993{ TextDataFormat.Rtf, DataFormats.Rtf, "a", "a" }, 995{ TextDataFormat.Html, DataFormats.Html, null, string.Empty }, 996{ TextDataFormat.Html, DataFormats.Html, new(), string.Empty }, 997{ TextDataFormat.Html, DataFormats.Html, string.Empty, string.Empty }, 998{ TextDataFormat.Html, DataFormats.Html, " ", " " }, 999{ TextDataFormat.Html, DataFormats.Html, "a", "a" }, 1001{ TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue, null, string.Empty }, 1002{ TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue, new(), string.Empty }, 1003{ TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue, string.Empty, string.Empty }, 1004{ TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue, " ", " " }, 1005{ TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue, "a", "a" }, 1056dataObject.GetData(DataFormats.WaveAudio, autoConvert: true).Should().BeOfType<MemoryStream>().Subject.ToArray().Should().Equal(audioBytes); 1057dataObject.GetData(DataFormats.WaveAudio, autoConvert: false).Should().BeOfType<MemoryStream>().Subject.ToArray().Should().Equal(audioBytes); 1060dataObject.GetDataPresent(DataFormats.WaveAudio, autoConvert: true).Should().BeTrue(); 1061dataObject.GetDataPresent(DataFormats.WaveAudio, autoConvert: false).Should().BeTrue(); 1085.Setup(o => o.SetData(DataFormats.WaveAudio, false, It.IsAny<MemoryStream>())) 1089mockDataObject.Verify(o => o.SetData(DataFormats.WaveAudio, false, It.IsAny<MemoryStream>()), Times.Once()); 1114dataObject.GetData(DataFormats.WaveAudio, autoConvert: true).Should().BeSameAs(audioStream); 1115dataObject.GetData(DataFormats.WaveAudio, autoConvert: false).Should().BeSameAs(audioStream); 1118dataObject.GetDataPresent(DataFormats.WaveAudio, autoConvert: true).Should().BeTrue(); 1119dataObject.GetDataPresent(DataFormats.WaveAudio, autoConvert: false).Should().BeTrue(); 1131.Setup(o => o.SetData(DataFormats.WaveAudio, false, audioStream)) 1134mockDataObject.Verify(o => o.SetData(DataFormats.WaveAudio, false, audioStream), Times.Once()); 1143.Setup(o => o.SetData(DataFormats.WaveAudio, false, audioStream)) 1147mockDataObject.Verify(o => o.SetData(DataFormats.WaveAudio, false, audioStream), Times.Once()); 1162{ new Mock<ISerializable>(MockBehavior.Strict).Object, DataFormats.Serializable } 1204dataObject.GetData(DataFormats.Serializable, autoConvert: false).Should().Be(data1); 1205dataObject.GetData(DataFormats.Serializable, autoConvert: true).Should().Be(data1); 1209dataObject.GetDataPresent(DataFormats.Serializable, autoConvert: false).Should().BeTrue(); 1210dataObject.GetDataPresent(DataFormats.Serializable, autoConvert: true).Should().BeTrue(); 1251theoryData.Add(format, null, format == DataFormats.FileDrop, format == DataFormats.Bitmap); 1252theoryData.Add(format, "input", format == DataFormats.FileDrop, format == DataFormats.Bitmap); 1282dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); 1285dataObject.ContainsText().Should().Be(format == DataFormats.UnicodeText); 1286dataObject.ContainsText(TextDataFormat.Text).Should().Be(format == DataFormats.UnicodeText); 1287dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format == DataFormats.UnicodeText); 1288dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format == DataFormats.Rtf); 1289dataObject.ContainsText(TextDataFormat.Html).Should().Be(format == DataFormats.Html); 1290dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue); 1338dataObject.SetData(DataFormats.Dib, autoConvert: true, image); 1341dataObject.GetData(DataFormats.Bitmap, autoConvert: true).Should().BeSameAs(image); 1342dataObject.GetData(DataFormats.Bitmap, autoConvert: false).Should().BeSameAs(image); 1345dataObject.GetData(DataFormats.Dib, autoConvert: true).Should().BeNull(); 1346dataObject.GetData(DataFormats.Dib, autoConvert: false).Should().BeNull(); 1349dataObject.GetDataPresent(DataFormats.Bitmap, autoConvert: true).Should().BeTrue(); 1350dataObject.GetDataPresent(DataFormats.Bitmap, autoConvert: false).Should().BeTrue(); 1353dataObject.GetDataPresent(DataFormats.Dib, autoConvert: true).Should().BeFalse(); 1354dataObject.GetDataPresent(DataFormats.Dib, autoConvert: false).Should().BeFalse(); 1395theoryData.Add(format, autoConvert, null, format == DataFormats.FileDrop, format == DataFormats.Bitmap); 1396theoryData.Add(format, autoConvert, "input", format == DataFormats.FileDrop, format == DataFormats.Bitmap); 1431dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); 1434dataObject.ContainsText().Should().Be(format == DataFormats.UnicodeText); 1435dataObject.ContainsText(TextDataFormat.Text).Should().Be(format == DataFormats.UnicodeText); 1436dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format == DataFormats.UnicodeText); 1437dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format == DataFormats.Rtf); 1438dataObject.ContainsText(TextDataFormat.Html).Should().Be(format == DataFormats.Html); 1439dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue); 1475dataObject.ContainsAudio().Should().Be(format == DataFormats.WaveAudio); 1491dataObject.SetData(DataFormats.Dib, autoConvert: true, image); 1494dataObject.GetData(DataFormats.Bitmap, autoConvert: true).Should().BeSameAs(image); 1495dataObject.GetData(DataFormats.Bitmap, autoConvert: false).Should().BeSameAs(image); 1498dataObject.GetData(DataFormats.Dib, autoConvert: true).Should().BeNull(); 1499dataObject.GetData(DataFormats.Dib, autoConvert: false).Should().BeNull(); 1502dataObject.GetDataPresent(DataFormats.Bitmap, autoConvert: true).Should().BeTrue(); 1503dataObject.GetDataPresent(DataFormats.Bitmap, autoConvert: false).Should().BeTrue(); 1506dataObject.GetDataPresent(DataFormats.Dib, autoConvert: true).Should().BeFalse(); 1507dataObject.GetDataPresent(DataFormats.Dib, autoConvert: false).Should().BeFalse(); 1597((Action)(() => dataObject.SetData(DataFormats.Dib, false, new Bitmap(10, 10)))) 1615dataObject.GetData(DataFormats.FileDrop, autoConvert: true).Should().BeEquivalentTo(filePaths.Cast<string>()); 1616dataObject.GetData(DataFormats.FileDrop, autoConvert: false).Should().BeEquivalentTo(filePaths.Cast<string>()); 1623dataObject.GetDataPresent(DataFormats.FileDrop, autoConvert: true).Should().BeTrue(); 1624dataObject.GetDataPresent(DataFormats.FileDrop, autoConvert: false).Should().BeTrue(); 1640.Setup(o => o.SetData(DataFormats.FileDrop, true, It.IsAny<string[]>())) 1643mockDataObject.Verify(o => o.SetData(DataFormats.FileDrop, true, It.IsAny<string[]>()), Times.Once()); 1652.Setup(o => o.SetData(DataFormats.FileDrop, true, It.IsAny<string[]>())) 1656mockDataObject.Verify(o => o.SetData(DataFormats.FileDrop, true, It.IsAny<string[]>()), Times.Once()); 1675dataObject.GetData(DataFormats.Bitmap, autoConvert: true).Should().BeSameAs(image); 1676dataObject.GetData(DataFormats.Bitmap, autoConvert: false).Should().BeSameAs(image); 1679dataObject.GetData(DataFormats.Dib, autoConvert: true).Should().BeNull(); 1680dataObject.GetData(DataFormats.Dib, autoConvert: false).Should().BeNull(); 1683dataObject.GetDataPresent(DataFormats.Bitmap, autoConvert: true).Should().BeTrue(); 1684dataObject.GetDataPresent(DataFormats.Bitmap, autoConvert: false).Should().BeTrue(); 1687dataObject.GetDataPresent(DataFormats.Dib, autoConvert: true).Should().BeFalse(); 1688dataObject.GetDataPresent(DataFormats.Dib, autoConvert: false).Should().BeFalse(); 1701.Setup(o => o.SetData(DataFormats.Bitmap, true, image)) 1704mockDataObject.Verify(o => o.SetData(DataFormats.Bitmap, true, image), Times.Once()); 1714.Setup(o => o.SetData(DataFormats.Bitmap, true, image)) 1718mockDataObject.Verify(o => o.SetData(DataFormats.Bitmap, true, image), Times.Once()); 1743dataObject.GetData(DataFormats.UnicodeText, autoConvert: true).Should().BeSameAs(textData); 1744dataObject.GetData(DataFormats.UnicodeText, autoConvert: false).Should().BeSameAs(textData); 1745dataObject.GetData(DataFormats.Text, autoConvert: true).Should().BeSameAs(textData); 1746dataObject.GetData(DataFormats.Text, autoConvert: false).Should().BeNull(); 1747dataObject.GetData(DataFormats.StringFormat, autoConvert: true).Should().BeSameAs(textData); 1748dataObject.GetData(DataFormats.StringFormat, autoConvert: false).Should().BeNull(); 1749dataObject.GetData(DataFormats.Rtf, autoConvert: true).Should().BeNull(); 1750dataObject.GetData(DataFormats.Rtf, autoConvert: false).Should().BeNull(); 1751dataObject.GetData(DataFormats.Html, autoConvert: true).Should().BeNull(); 1752dataObject.GetData(DataFormats.Html, autoConvert: false).Should().BeNull(); 1753dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: true).Should().BeNull(); 1754dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: false).Should().BeNull(); 1757dataObject.GetDataPresent(DataFormats.UnicodeText, autoConvert: true).Should().BeTrue(); 1758dataObject.GetDataPresent(DataFormats.UnicodeText, autoConvert: false).Should().BeTrue(); 1759dataObject.GetDataPresent(DataFormats.Text, autoConvert: true).Should().BeFalse(); 1760dataObject.GetDataPresent(DataFormats.Text, autoConvert: false).Should().BeFalse(); 1761dataObject.GetDataPresent(DataFormats.StringFormat, autoConvert: true).Should().BeFalse(); 1762dataObject.GetDataPresent(DataFormats.StringFormat, autoConvert: false).Should().BeFalse(); 1763dataObject.GetDataPresent(DataFormats.Rtf, autoConvert: true).Should().BeFalse(); 1764dataObject.GetDataPresent(DataFormats.Rtf, autoConvert: false).Should().BeFalse(); 1765dataObject.GetDataPresent(DataFormats.Html, autoConvert: true).Should().BeFalse(); 1766dataObject.GetDataPresent(DataFormats.Html, autoConvert: false).Should().BeFalse(); 1767dataObject.GetDataPresent(DataFormats.CommaSeparatedValue, autoConvert: true).Should().BeFalse(); 1768dataObject.GetDataPresent(DataFormats.CommaSeparatedValue, autoConvert: false).Should().BeFalse(); 1792.Setup(o => o.SetData(DataFormats.UnicodeText, false, textData)) 1796mockDataObject.Verify(o => o.SetData(DataFormats.UnicodeText, false, textData), Times.Once()); 1822dataObject.GetData(DataFormats.UnicodeText, autoConvert: true).Should().Be(expectedUnicodeText); 1823dataObject.GetData(DataFormats.UnicodeText, autoConvert: false).Should().Be(expectedUnicodeText); 1824dataObject.GetData(DataFormats.Text, autoConvert: true).Should().Be(expectedUnicodeText); 1825dataObject.GetData(DataFormats.Text, autoConvert: false).Should().BeNull(); 1826dataObject.GetData(DataFormats.StringFormat, autoConvert: true).Should().Be(expectedUnicodeText); 1827dataObject.GetData(DataFormats.StringFormat, autoConvert: false).Should().BeNull(); 1828dataObject.GetData(DataFormats.Rtf, autoConvert: true).Should().Be(expectedRtfText); 1829dataObject.GetData(DataFormats.Rtf, autoConvert: false).Should().Be(expectedRtfText); 1830dataObject.GetData(DataFormats.Html, autoConvert: true).Should().Be(expectedHtmlText); 1831dataObject.GetData(DataFormats.Html, autoConvert: false).Should().Be(expectedHtmlText); 1832dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: true).Should().Be(expectedCsvText); 1833dataObject.GetData(DataFormats.CommaSeparatedValue, autoConvert: false).Should().Be(expectedCsvText); 1836dataObject.GetDataPresent(DataFormats.UnicodeText, autoConvert: true).Should().Be(expectedUnicodeText is not null); 1837dataObject.GetDataPresent(DataFormats.UnicodeText, autoConvert: false).Should().Be(expectedUnicodeText is not null); 1838dataObject.GetDataPresent(DataFormats.Text, autoConvert: true).Should().BeFalse(); 1839dataObject.GetDataPresent(DataFormats.Text, autoConvert: false).Should().BeFalse(); 1840dataObject.GetDataPresent(DataFormats.StringFormat, autoConvert: true).Should().BeFalse(); 1841dataObject.GetDataPresent(DataFormats.StringFormat, autoConvert: false).Should().BeFalse(); 1842dataObject.GetDataPresent(DataFormats.Rtf, autoConvert: true).Should().Be(expectedRtfText is not null); 1843dataObject.GetDataPresent(DataFormats.Rtf, autoConvert: false).Should().Be(expectedRtfText is not null); 1844dataObject.GetDataPresent(DataFormats.Html, autoConvert: true).Should().Be(expectedHtmlText is not null); 1845dataObject.GetDataPresent(DataFormats.Html, autoConvert: false).Should().Be(expectedHtmlText is not null); 1846dataObject.GetDataPresent(DataFormats.CommaSeparatedValue, autoConvert: true).Should().Be(expectedCsvText is not null); 1847dataObject.GetDataPresent(DataFormats.CommaSeparatedValue, autoConvert: false).Should().Be(expectedCsvText is not null); 1855theoryData.Add(textData, TextDataFormat.Text, DataFormats.UnicodeText); 1856theoryData.Add(textData, TextDataFormat.UnicodeText, DataFormats.UnicodeText); 1857theoryData.Add(textData, TextDataFormat.Rtf, DataFormats.Rtf); 1858theoryData.Add(textData, TextDataFormat.Html, DataFormats.Html); 1859theoryData.Add(textData, TextDataFormat.CommaSeparatedValue, DataFormats.CommaSeparatedValue); 1922data.GetData(DataFormats.EnhancedMetafile).Should().BeNull(); 2105{ DataFormats.Bitmap, TYMED.TYMED_GDI }, 2106{ DataFormats.CommaSeparatedValue, TYMED.TYMED_HGLOBAL }, 2107{ DataFormats.Dib, TYMED.TYMED_HGLOBAL }, 2108{ DataFormats.Dif, TYMED.TYMED_HGLOBAL }, 2109{ DataFormats.EnhancedMetafile, TYMED.TYMED_HGLOBAL }, 2110{ DataFormats.FileDrop, TYMED.TYMED_HGLOBAL }, 2113{ DataFormats.Html, TYMED.TYMED_HGLOBAL }, 2114{ DataFormats.Locale, TYMED.TYMED_HGLOBAL }, 2115{ DataFormats.MetafilePict, TYMED.TYMED_HGLOBAL }, 2116{ DataFormats.OemText, TYMED.TYMED_HGLOBAL }, 2117{ DataFormats.Palette, TYMED.TYMED_HGLOBAL }, 2118{ DataFormats.PenData, TYMED.TYMED_HGLOBAL }, 2119{ DataFormats.Riff, TYMED.TYMED_HGLOBAL }, 2120{ DataFormats.Rtf, TYMED.TYMED_HGLOBAL }, 2121{ DataFormats.Serializable, TYMED.TYMED_HGLOBAL }, 2122{ DataFormats.StringFormat, TYMED.TYMED_HGLOBAL }, 2123{ DataFormats.SymbolicLink, TYMED.TYMED_HGLOBAL }, 2124{ DataFormats.Text, TYMED.TYMED_HGLOBAL }, 2125{ DataFormats.Tiff, TYMED.TYMED_HGLOBAL }, 2126{ DataFormats.UnicodeText, TYMED.TYMED_HGLOBAL }, 2127{ DataFormats.WaveAudio, TYMED.TYMED_HGLOBAL } 2165result[0].cfFormat.Should().Be(unchecked((short)(ushort)(DataFormats.GetFormat(format1).Id))); 2247.Returns(["Format1", DataFormats.Bitmap, "Format2"]); 2268result[0].cfFormat.Should().Be(unchecked((short)(ushort)(DataFormats.GetFormat("Format1").Id))); 2278result[0].cfFormat.Should().Be(unchecked((short)(ushort)(DataFormats.GetFormat("Format2").Id))); 2355result[0].cfFormat.Should().Be(unchecked((short)(ushort)(DataFormats.GetFormat(format1).Id))); 2452{ TextDataFormat.Rtf, (short)DataFormats.GetFormat(DataFormats.Rtf).Id }, 2453{ TextDataFormat.Html, (short)DataFormats.GetFormat(DataFormats.Html).Id } 2910DataObject native = new(DataFormats.Locale, value);
System\Windows\Forms\DragDropHelperTests.cs (1)
14System.Windows.Forms.DataFormats.Format>;
System\Windows\Forms\RichTextBoxTests.ClipboardTests.cs (6)
46richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text)); 58richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text)); 79richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Rtf));
System\Windows\Forms\RichTextBoxTests.cs (7)
7841yield return new object[] { DataFormats.GetFormat(DataFormats.Palette), false }; 7842yield return new object[] { new DataFormats.Format("UnknownName", int.MaxValue), false }; 7847public void RichTextBox_CanPaste_Invoke_ReturnsExpected(DataFormats.Format format, bool expected) 7856public void RichTextBox_CanPaste_InvokeWithHandle_ReturnsExpected(DataFormats.Format format, bool expected) 7889Assert.Equal(expected, control.CanPaste(DataFormats.GetFormat(DataFormats.Text)));
System.Windows.Forms.TestUtilities (19)
Data\DataObjectTestHelpers.cs (19)
17DataFormats.Text, 18DataFormats.UnicodeText, 20DataFormats.Rtf, 21DataFormats.Html, 22DataFormats.OemText, 23DataFormats.FileDrop, 30DataFormats.Serializable, 37DataFormats.CommaSeparatedValue, 38DataFormats.Dib, 39DataFormats.Dif, 40DataFormats.PenData, 41DataFormats.Riff, 42DataFormats.Tiff, 43DataFormats.WaveAudio, 44DataFormats.SymbolicLink, 45DataFormats.EnhancedMetafile, 46DataFormats.MetafilePict, 47DataFormats.Palette 52DataFormats.Bitmap,
System.Windows.Forms.UI.IntegrationTests (10)
DragDropTests.cs (10)
288if (e.Data?.GetDataPresent(DataFormats.Serializable) ?? false) 295if (e.Data?.GetDataPresent(DataFormats.Serializable) ?? false) 298data = (ListViewItem?)e.Data?.GetData(DataFormats.Serializable); 312data.SetData(DataFormats.Serializable, listViewItem); 1089DataObject data = new(DataFormats.FileDrop, dropFiles); 1107&& e.Data.GetDataPresent(DataFormats.FileDrop) 1108&& e.Data.GetData(DataFormats.FileDrop) is string[] fileNames 1122&& e.Data.GetDataPresent(DataFormats.FileDrop) 1123&& e.Data.GetData(DataFormats.FileDrop) is string[] fileNames 1149DataObject data = new(DataFormats.FileDrop, dropFiles);
TrimTest (3)
Form1.cs (3)
19if (e.Data is { } dataObject && dataObject.GetDataPresent(DataFormats.UnicodeText)) 27if (e.Data is { } dataObject && dataObject.GetDataPresent(DataFormats.UnicodeText)) 35if (e.Data is { } dataObject && dataObject.GetData(DataFormats.UnicodeText) is string text)
WinFormsControlsTest (11)
DragDrop.cs (11)
112if (e.Data.GetDataPresent(DataFormats.FileDrop) 113&& e.Data.GetData(DataFormats.FileDrop) is string[] files 159if (e.Data.GetDataPresent(DataFormats.FileDrop) 160&& e.Data.GetData(DataFormats.FileDrop) is string[] files 252else if (e.Data.GetDataPresent(DataFormats.FileDrop) 253&& e.Data.GetData(DataFormats.FileDrop) is string[] files 294else if (e.Data.GetDataPresent(DataFormats.FileDrop) 295&& e.Data.GetData(DataFormats.FileDrop) is string[] files 317if (e.Data.GetDataPresent(DataFormats.FileDrop) 346&& e.Data.GetDataPresent(DataFormats.FileDrop) 537DataObject data = new(DataFormats.FileDrop,