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