225 references to Clipboard
ComDisabled.Tests (3)
ClipboardComTests.cs (3)
17Clipboard.SetText("text"); 19Clipboard.GetText().Should().Be("text"); 20Clipboard.ContainsText().Should().BeTrue();
Microsoft.CodeAnalysis.EditorFeatures.Wpf (3)
StringCopyPaste\WpfStringCopyPasteService.cs (3)
36var dataObject = Clipboard.GetDataObject(); 50Clipboard.SetDataObject(copy, copy: false, retryTimes: 5, retryDelay: 50); 69var dataObject = Clipboard.GetDataObject();
Microsoft.VisualBasic.Forms (22)
Microsoft\VisualBasic\MyServices\ClipboardProxy.vb (22)
29Clipboard.Clear() 37Return Clipboard.ContainsAudio() 46Return Clipboard.ContainsData(format) 54Return Clipboard.ContainsFileDropList() 62Return Clipboard.ContainsImage() 70Return Clipboard.ContainsText 80Return Clipboard.ContainsText(format) 88Return Clipboard.GetAudioStream() 97Return Clipboard.GetData(format) 107Return Clipboard.GetDataObject() 115Return Clipboard.GetFileDropList() 123Return Clipboard.GetImage() 131Return Clipboard.GetText() 140Return Clipboard.GetText(format) 148Clipboard.SetAudio(audioBytes) 156Clipboard.SetAudio(audioStream) 165Clipboard.SetData(format, data) 175Clipboard.SetDataObject(data) 183Clipboard.SetFileDropList(filePaths) 191Clipboard.SetImage(image) 199Clipboard.SetText(text) 208Clipboard.SetText(text, format)
Microsoft.VisualBasic.Forms.Tests (7)
System\Windows\Forms\ClipboardProxyTests.vb (7)
29Clipboard.ContainsText(format:=TextDataFormat.Text).Should.Be(expected) 37clipboardProxy.ContainsAudio().Should.Be(Clipboard.ContainsAudio) 39Using clipboardAudio As MemoryStream = CType(Clipboard.GetAudioStream, MemoryStream) 51clipboardProxy.ContainsAudio().Should.Be(Clipboard.ContainsAudio) 53Using clipboardWaveAudio As MemoryStream = CType(Clipboard.GetAudioStream, MemoryStream) 66clipboardProxy.ContainsFileDropList().Should.Be(Clipboard.ContainsFileDropList) 67clipboardProxy.GetFileDropList.Should.BeEquivalentTo(Clipboard.GetFileDropList)
Microsoft.VisualBasic.Tests (12)
Microsoft\VisualBasic\MyServices\ClipboardProxyTests.cs (12)
25clipboard.ContainsAudio().Should().Be(System.Windows.Forms.Clipboard.ContainsAudio()); 34System.Windows.Forms.Clipboard.ContainsText().Should().BeTrue(); 36System.Windows.Forms.Clipboard.ContainsText().Should().BeFalse(); 45clipboard.ContainsData(DataFormats.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.ContainsData(DataFormats.UnicodeText)); 46clipboard.GetData(DataFormats.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.GetData(DataFormats.UnicodeText)); 55clipboard.GetDataObject().GetData(DataFormats.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.GetDataObject()?.GetData(DataFormats.UnicodeText)); 62System.Windows.Forms.Clipboard.ContainsFileDropList().Should().Be(clipboard.ContainsFileDropList()); 70System.Windows.Forms.Clipboard.ContainsImage().Should().Be(clipboard.ContainsImage()); 71System.Windows.Forms.Clipboard.GetImage().Should().Be(clipboard.GetImage()); 81System.Windows.Forms.Clipboard.ContainsText().Should().Be(clipboard.ContainsText()); 82System.Windows.Forms.Clipboard.GetText().Should().Be(clipboard.GetText()); 83System.Windows.Forms.Clipboard.GetText(TextDataFormat.UnicodeText).Should().Be(clipboard.GetText(TextDataFormat.UnicodeText));
System.Windows.Forms (24)
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
21875Clipboard.SetDataObject(dataObject);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (4)
1015Clipboard.SetDataObject(_selectedGridEntry.GetPropertyTextValue()); 1045IDataObject? dataObj = Clipboard.GetDataObject(); 2888Clipboard.SetDataObject(entry.GetPropertyTextValue()); 2915Clipboard.SetDataObject(entry.GetTestingInfo());
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (3)
2737Clipboard.Clear(); 2741Clipboard.SetText(text); 2881text = Clipboard.GetText();
System\Windows\Forms\OLE\Clipboard.cs (12)
18/// Places non-persistent data on the system <see cref="Clipboard"/>. 29/// Places data on the system <see cref="Clipboard"/> and uses copy to specify whether the data 30/// should remain on the <see cref="Clipboard"/> after the application exits. 77/// Retrieves the data that is currently on the system <see cref="Clipboard"/>. 219/// Retrieves an audio stream from the <see cref="Clipboard"/>. 224/// Retrieves data from the <see cref="Clipboard"/> in the specified format. 236/// Retrieves a collection of file names from the <see cref="Clipboard"/>. 251/// Retrieves an image from the <see cref="Clipboard"/>. 256/// Retrieves text data from the <see cref="Clipboard"/> in the <see cref="TextDataFormat.UnicodeText"/> format. 261/// Retrieves text data from the <see cref="Clipboard"/> in the format indicated by the specified 271/// Clears the <see cref="Clipboard"/> and then adds data in the <see cref="DataFormats.WaveAudio"/> format. 276/// Clears the <see cref="Clipboard"/> and then adds data in the <see cref="DataFormats.WaveAudio"/> format.
System\Windows\Forms\OLE\DataFormats.cs (2)
11/// Translates between WinForms text-based <see cref="Clipboard"/> 14/// <see cref="Clipboard"/> formats and add them to the Windows Registry.
System\Windows\Forms\OLE\DataFormats.Format.cs (2)
7/// Translates between WinForms text-based <see cref="Clipboard"/> 10/// <see cref="Clipboard"/> formats and add them to the Windows Registry.
System.Windows.Forms.Design (4)
System\Windows\Forms\Design\CommandSet.cs (4)
1416if (!ExecuteSafely(() => Clipboard.SetDataObject(dataObj), throwOnException: false)) 1462if (ExecuteSafely(() => Clipboard.SetDataObject(dataObj), throwOnException: false)) 1846bool clipboardOperationSuccessful = ExecuteSafely(Clipboard.GetDataObject, false, out IDataObject? dataObj); 3095bool clipboardOperationSuccessful = ExecuteSafely(Clipboard.GetDataObject, false, out IDataObject? dataObj);
System.Windows.Forms.Tests (149)
System\Windows\Forms\ClipboardTests.cs (141)
26Clipboard.SetText("text"); 27Clipboard.GetText().Should().Be("text"); 28Clipboard.ContainsText().Should().BeTrue(); 34Clipboard.Clear(); 35Clipboard.ContainsAudio().Should().BeFalse(); 36Clipboard.ContainsData("format").Should().BeFalse(); 37Clipboard.ContainsFileDropList().Should().BeFalse(); 38Clipboard.ContainsImage().Should().BeFalse(); 39Clipboard.ContainsText().Should().BeFalse(); 41Clipboard.Clear(); 42Clipboard.ContainsAudio().Should().BeFalse(); 43Clipboard.ContainsData("format").Should().BeFalse(); 44Clipboard.ContainsFileDropList().Should().BeFalse(); 45Clipboard.ContainsImage().Should().BeFalse(); 46Clipboard.ContainsText().Should().BeFalse(); 51Clipboard.ContainsAudio, 52Clipboard.ContainsFileDropList, 53Clipboard.ContainsImage, 54Clipboard.ContainsText 61Clipboard.Clear(); 71bool result = Clipboard.ContainsData(format); 72Clipboard.ContainsData(format).Should().Be(result); 80bool result = Clipboard.ContainsText(format); 81Clipboard.ContainsText(format).Should().Be(result); 88Action action = () => Clipboard.ContainsText(format); 95Stream? result = Clipboard.GetAudioStream(); 96(Clipboard.GetAudioStream() == result).Should().BeTrue(); 105object? result = Clipboard.GetData(format!); 107result = Clipboard.GetData(format!); 114IDataObject? result = Clipboard.GetDataObject(); 115(result == Clipboard.GetDataObject()).Should().BeFalse(); 121StringCollection result = Clipboard.GetFileDropList(); 122Clipboard.GetFileDropList().Should().BeEquivalentTo(result); 128Image? result = Clipboard.GetImage(); 129Clipboard.GetImage().Should().BeEquivalentTo(result); 135string result = Clipboard.GetText(); 136Clipboard.GetText().Should().Be(result); 143string result = Clipboard.GetText(format); 144Clipboard.GetText(format).Should().Be(result); 151Action action = () => Clipboard.GetText(format); 159Clipboard.SetAudio(audioBytes); 161Clipboard.GetAudioStream().Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes); 162Clipboard.GetData(DataFormats.WaveAudio).Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes); 163Clipboard.ContainsAudio().Should().BeTrue(); 164Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 171Clipboard.SetAudio(audioBytes); 173Clipboard.GetAudioStream().Should().BeNull(); 174Clipboard.GetData(DataFormats.WaveAudio).Should().BeNull(); 175Clipboard.ContainsAudio().Should().BeTrue(); 176Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 182Action action = () => Clipboard.SetAudio((byte[])null!); 191Clipboard.SetAudio(audioStream); 193Clipboard.GetAudioStream().Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes); 194Clipboard.GetData(DataFormats.WaveAudio).Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes); 195Clipboard.ContainsAudio().Should().BeTrue(); 196Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 203Clipboard.SetAudio(audioStream); 205Clipboard.GetAudioStream().Should().BeNull(); 206Clipboard.GetData(DataFormats.WaveAudio).Should().BeNull(); 207Clipboard.ContainsAudio().Should().BeTrue(); 208Clipboard.ContainsData(DataFormats.WaveAudio).Should().BeTrue(); 214Action action = () => Clipboard.SetAudio((Stream)null!); 223Clipboard.SetData(format, data!); 224Clipboard.GetData(format).Should().Be(data); 225Clipboard.ContainsData(format).Should().BeTrue(); 235Action action = () => Clipboard.SetData(format!, "data"); 244Action action = () => Clipboard.SetData("MyData", data: null!); 248Clipboard.ContainsData("MyData").Should().BeTrue(); 249Clipboard.GetData("MyData").Should().BeNull(); 253Clipboard.Clear(); 262Clipboard.SetDataObject(data); 264var dataObject = Clipboard.GetDataObject(); 267Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); 276Clipboard.SetDataObject(dataObject); 278DataObject actual = Clipboard.GetDataObject().Should().BeOfType<DataObject>().Subject; 280Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); 290Clipboard.SetDataObject(data, copy); 292DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType<DataObject>().Subject; 294Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); 305Clipboard.SetDataObject(dataObject, copy, retryTimes, retryDelay); 307DataObject actual = Clipboard.GetDataObject().Should().BeOfType<DataObject>().Which; 309Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); 319Clipboard.SetDataObject(data, copy, retryTimes, retryDelay); 321DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType<DataObject>().Which; 323Clipboard.ContainsData(data.GetType().FullName).Should().BeTrue(); 328() => Clipboard.SetDataObject(null!), 329() => Clipboard.SetDataObject(null!, copy: true), 330() => Clipboard.SetDataObject(null!, copy: true, retryTimes: 10, retryDelay: 0) 343Action action = () => Clipboard.SetDataObject(new object(), copy: true, retryTimes: -1, retryDelay: 0); 350Action action = () => Clipboard.SetDataObject(new object(), copy: true, retryTimes: 10, retryDelay: -1); 356Clipboard.Clear, 357() => Clipboard.SetAudio(Array.Empty<byte>()), 358() => Clipboard.SetAudio(new MemoryStream()), 359() => Clipboard.SetData("format", data: null!), 360() => Clipboard.SetDataObject(null!), 361() => Clipboard.SetDataObject(null!, copy: true), 362() => Clipboard.SetDataObject(null!, copy: true, retryTimes: 10, retryDelay: 0), 363() => Clipboard.SetFileDropList(["filePath"]), 364() => Clipboard.SetText("text"), 365() => Clipboard.SetText("text", TextDataFormat.Text) 381Action action = () => Clipboard.SetImage(bitmap); 383action = () => Clipboard.SetImage(metafile); 385action = () => Clipboard.SetImage(enhancedMetafile); 397Clipboard.SetFileDropList(filePaths); 399Clipboard.GetFileDropList().Should().BeEquivalentTo(filePaths); 400Clipboard.ContainsFileDropList().Should().BeTrue(); 406Action action = () => Clipboard.SetFileDropList(null!); 413Action action = static () => Clipboard.SetFileDropList([]); 426Action action = () => Clipboard.SetFileDropList(filePaths); 435Clipboard.SetImage(bitmap); 436Bitmap result = Assert.IsType<Bitmap>(Clipboard.GetImage()); 439Clipboard.ContainsImage().Should().BeTrue(); 448Clipboard.SetImage(metafile); 450Clipboard.GetImage().Should().BeNull(); 451Clipboard.ContainsImage().Should().BeTrue(); 455Clipboard.Clear(); 465Clipboard.SetImage(metafile); 467Clipboard.GetImage().Should().BeNull(); 468Clipboard.ContainsImage().Should().BeTrue(); 472Clipboard.Clear(); 479Action action = () => Clipboard.SetImage(null!); 487Clipboard.SetText("text", format); 488Clipboard.GetText(format).Should().Be("text"); 489Clipboard.ContainsText(format).Should().BeTrue(); 496Action action = () => Clipboard.SetText(text); 498action = () => Clipboard.SetText(text, TextDataFormat.Text); 506Action action = () => Clipboard.SetText("text", format); 514Clipboard.SetData(format, Color.Black); 516Clipboard.ContainsData(format).Should().BeTrue(); 517Clipboard.GetData(format).Should().Be(Color.Black); 527Clipboard.SetData(format, new FileNotFoundException()); 528Clipboard.ContainsData(format).Should().BeTrue(); 529Clipboard.GetData(format).Should().BeOfType<NotSupportedException>(); 558Clipboard.SetDataObject(realDataObject); 560IDataObject? clipboardDataObject = Clipboard.GetDataObject(); 564Clipboard.SetDataObject(clipboardDataObject!); 565IDataObject? clipboardDataObject2 = Clipboard.GetDataObject(); 574Clipboard.SetDataObject(realDataObject); 576IDataObject? clipboardDataObject = Clipboard.GetDataObject(); 636Clipboard.Clear(); 643DataObject dataObject = Clipboard.GetDataObject().Should().BeOfType<DataObject>().Which;
System\Windows\Forms\RichTextBoxTests.ClipboardTests.cs (5)
23Clipboard.SetData("Embed Source", memoryStream); 43Clipboard.SetText(value); 55Clipboard.SetText("non-empty"); 56Clipboard.Clear(); 77Clipboard.SetText(rtf);
System\Windows\Forms\ToolStripTextBoxTests.ClipboardTests.cs (1)
40Clipboard.SetText(textToPaste);
TextBoxBaseTests.ClipboardTests.cs (2)
158Clipboard.Clear(); 168Clipboard.Clear();
TrimTest (1)
Form1.cs (1)
44Clipboard.SetText(text);