Here are the examples of the csharp api class System.Windows.Forms.Clipboard.GetText(System.Windows.Forms.TextDataFormat) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
33 Examples
0
1. Example
View licensepublic static string GetText(TextDataFormat format = TextDataFormat.Text) => Misc.WithRetries(() => Clipboard.GetText(format), 500, false);
0
2. Example
View licensestatic public HtmlFragment FromClipboard() { string rawClipboardText = Clipboard.GetText(TextDataFormat.Html); var h = new HtmlFragment(rawClipboardText); return h; }
0
3. Example
View licenseprivate void txtPasteData_Click(object sender, EventArgs e) { txtInput.Text = Clipboard.GetText(TextDataFormat.Text); }
0
0
5. Example
View licensevoid WaitForText(string value) { int retries = 20; string clip = null; while (retries-- > 0) { this.window.SendKeystrokes("^c"); clip = Clipboard.GetText(); Trace.WriteLine("clip=" + clip); if (clip == value) return; Sleep(2000); } throw new Exception("Not finding expected text '" + value + "', instead we got '" + clip + "'"); }
0
6. Example
View licensestring CopyHtml() { AutomationWrapper xsltViewer = this.window.FindDescendant("xsltViewer"); Rectangle bounds = xsltViewer.Bounds; // click in HTML view Mouse.MouseClick(bounds.Center(), MouseButtons.Left); // select all the text Sleep(1000); this.window.SendKeystrokes("^a"); Sleep(1000); this.window.SendKeystrokes("^c"); return Clipboard.GetText(); }
0
7. Example
View licenseprivate void cmnuPSFConsole_Opening(object sender, CancelEventArgs e) { cmbtnCopy.Enabled = false; cmbtnPaste.Enabled = false; if (txtPShellOutput.SelectedText.Length > 0) { cmbtnCopy.Enabled = true; } String cliptxt = Clipboard.GetText(TextDataFormat.Text); if (cliptxt != null && cliptxt != "") { cmbtnPaste.Enabled = true; } }
0
8. Example
View licensepublic override string GetText() { return System.Windows.Forms.Clipboard.GetText(TextDataFormat.UnicodeText); }
7
9. Example
View licenseprivate void ImportURLItem_Click(object sender, EventArgs e) { var success = controller.AddServerBySSURL(Clipboard.GetText(TextDataFormat.Text)); if (success) { ShowConfigForm(); } }
0
10. Example
View licenseprivate void toolStripButton2_Click(object sender, EventArgs e) { ShowCode(Clipboard.GetText(TextDataFormat.Text), NetLanguage.CSharp); }
0
11. Example
View licensepublic virtual void CheckClipboard(string expected) { if (!Clipboard.ContainsText()) { throw new ApplicationException("clipboard does not contain any text!"); } string text = Clipboard.GetText(); if (text != expected) { throw new ApplicationException("clipboard does not match expected cut node"); } }
0
12. Example
View licenseprivate void pasteToolStripMenuItem_Click(object sender, EventArgs e) { string text = Clipboard.GetText(); if (!string.IsNullOrEmpty(text)) { Push(new SchemaDialogAddFiles(this.dataGridView1, this.items, text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))); } }
0
13. Example
View licenseprivate void cmbtnPaste_Click(object sender, EventArgs e) { //This gets rid of any formating and nontext data. Clipboard.SetText(Clipboard.GetText(TextDataFormat.Text)); txtPShellOutput.Paste(); }
0
14. Example
View licenseprivate void linkLabelCopyFromClipboard_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { var text = Clipboard.ContainsText(TextDataFormat.UnicodeText) ? Clipboard.GetText(TextDataFormat.UnicodeText) : ""; SettingsView.Configuration.GoogleMapSettings.InitialSettings = text; } catch { } }
0
15. Example
View license[Test] [Category.Project] public async Task CopyItemPath() { IImmutableSet<IProjectTree> nodes1; IImmutableSet<IProjectTree> nodes2; var filePath = @"C:\Temp"; CreateTestNodeSetPair(filePath, out nodes1, out nodes2); var cmd = new CopyItemPathCommand(_interactiveWorkflowProvider); await InUI(() => CheckSingleNodeCommandStatusAsync(cmd, RPackageCommandId.icmdCopyItemPath, nodes1, nodes2)); var contents = await InUI(() => Clipboard.GetText()); contents.Should().Be("\"" + filePath + "\""); }
0
16. Example
View license[TestMethod] public void TestSchemaDialog() { Trace.WriteLine("TestSchemaDialog=/n ..... /n //View Source file for more details /n }
0
17. Example
View licensepublic void CheckClipboard(Regex expected) { int retries = 5; while (retries-- > 0) { if (Clipboard.ContainsText()) { string text = Clipboard.GetText(); if (expected.IsMatch(text)) { return; } } Sleep(250); } if (!Clipboard.ContainsText()) { throw new ApplicationException("clipboard does not contain any text!"); } throw new ApplicationException(@"clipboard [" + Clipboard.GetText() + "] does not match expected value: [" + expected + "]"); }
0
18. Example
View licenseprivate void TextBox1KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == K/n ..... /n //View Source file for more details /n }
0
19. Example
View licensepublic override void CheckClipboard(string expected) { int retries = 5; string text = null; while (retries-- > 0) { if (Clipboard.ContainsText()) { text = Clipboard.GetText(); if (IsNormalizedEqual(Clipboard.GetText(), expected)) { return; } } Sleep(250); } if (!Clipboard.ContainsText()) { throw new ApplicationException("clipboard does not contain any text!"); } AssertNormalizedEqual(""+ text, expected); }
0
20. Example
View licensepublic void CheckClipboard(string expected, StringComparison comparison) { int retries = 5; string text = null; while (retries-- > 0) { if (Clipboard.ContainsText()) { text = Clipboard.GetText(); if (IsNormalizedEqual(text, expected, comparison)) { return; } } Sleep(250); } if (!Clipboard.ContainsText()) { throw new ApplicationException("clipboard does not contain any text!"); } AssertNormalizedEqual("" + text, expected, comparison); }
0
21. Example
View licensevoid requestPasteAction(object sender, EventArgs e) { if (Clipboard.ContainsText()) { textBox4.Text += Clipboard.GetText(TextDataFormat.Text).ToString(); } HighlightRTF(textBox4); }
0
22. Example
View licensevoid requestPasteAction(object sender, EventArgs e) { if (Clipboard.ContainsText()) { requestEdit.Text += Clipboard.GetText(TextDataFormat.Text).ToString(); } HighlightRTF(requestEdit); }
0
23. Example
View licensevoid responsePasteAction(object sender, EventArgs e) { if (Clipboard.ContainsText()) { response.Text += Clipboard.GetText(TextDataFormat.Text).ToString(); } HighlightRTF(response); }
0
24. Example
View licenseprivate void TextBox1KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == K/n ..... /n //View Source file for more details /n }
0
25. Example
View licenseprotected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Key/n ..... /n //View Source file for more details /n }
0
26. Example
View licenseprivate void pasteToolStripMenuItem_Click(object sender, EventArgs e) { string txt = Clipboard.GetText(TextDataFormat.UnicodeText); string[] lines = txt.Split('\n').Select(s => s.Trim('\r')).ToArray(); foreach (string line in lines) { string[] fields = line.Split('\t'); string sysname = fields[0].Trim(); string dist = fields.Length >= 2 ? fields[1].Trim() : null; if (sysname != "") { var row = dataGridViewDistances.Rows.Add(sysname, dist); dataGridViewDistances_CellEndEdit(this, new DataGridViewCellEventArgs(0, row)); if (dist != "") { dataGridViewDistances_CellEndEdit(this, new DataGridViewCellEventArgs(1, row)); } } } }
0
27. Example
View license[TestMethod] public void TestChangeTo() { Trace.WriteLine("TestChangeTo=========/n ..... /n //View Source file for more details /n }
0
28. Example
View licenseprotected override void OnRuntimeLoad(EventArgs e) { base.OnRuntimeLoad(e); /n ..... /n //View Source file for more details /n }
0
29. Example
View licenseprotected override void OnKeyDown(KeyEventArgs e) { if ((e.KeyCode == Keys.V && 0 != (e.Modifiers & Keys.Control)) || (e.KeyCode == Keys.Insert && 0 != (e.Modifiers & Keys.Shift))) { e.Handled = true; PausePainting(); try { // We do this in the middle of a paused painting because this way the text isn't // drawn twice: once without syntax highlighting and then with highlight if (Clipboard.ContainsText()) { string text = Clipboard.GetText(TextDataFormat.UnicodeText); if (TextLength - SelectionLength + text.Length <= MaxLength) SelectedText = text; } DetectAndSaveChange(); } finally { ResumePainting(); } } else if (e.KeyCode == Keys.Z && 0 != (e.Modifiers & Keys.Control)) { Undo(); e.Handled = true; } else if (e.KeyCode == Keys.Y && 0 != (e.Modifiers & Keys.Control)) { Redo(); e.Handled = true; } if (!e.Handled) base.OnKeyDown(e); }
0
30. Example
View licensepublic static void ClipboardStripHtmlStyles(){ if (!Clipboard.ContainsText(TextDataFormat.Html) || !Clipboard.ContainsText(TextDataFormat.UnicodeText)){ return; } string originalText = Clipboard.GetText(TextDataFormat.UnicodeText); string originalHtml = Clipboard.GetText(TextDataFormat.Html); string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty); int removed = originalHtml.Length-updatedHtml.Length; updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0')); DataObject obj = new DataObject(); obj.SetText(originalText, TextDataFormat.UnicodeText); obj.SetText(updatedHtml, TextDataFormat.Html); SetClipboardData(obj); }
0
31. Example
View licenseprivate void LoadFromCsv() { if (Clipboard.ContainsText(TextDataFormat.Text)) /n ..... /n //View Source file for more details /n }
0
32. Example
View licensevoid GetClipboardContents() { if (_image) { if (WinF/n ..... /n //View Source file for more details /n }
0
33. Example
View licenseprivate void PasteFromClipboard() { try { // Get dat/n ..... /n //View Source file for more details /n }