Here are the examples of the csharp api class System.Windows.Forms.Clipboard.GetText() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
160 Examples
0
1. Example
View licensepublic static string GetText() { string result = ThreadExt.RunSTA(() => { string text = Clipboard.GetText(); return text; }, 6000); return result; }
0
2. Example
View licenseprivate void toggleFormatClearButton_Click(object sender, EventArgs e) { try /n ..... /n //View Source file for more details /n }
0
3. Example
View licenseprivate void pasteButton_Click(object sender, EventArgs e) { Url = Clipboard.GetText(); urlTextbox.Focus(); }
0
4. Example
View licenseprivate void btnPaste_Click(object sender, EventArgs e) { txtJson.Text = Clipboard.GetText(); }
0
5. Example
View licenseprivate void bunifuImageButton1_Click(object sender, EventArgs e) { SecretMessageBox2.Text = Clipboard.GetText(); }
0
6. Example
View licenseprivate void ???????????ToolStripMenuItem_Click(object sender, EventArgs e) { scintillaEditor.Selection.Text = Clipboard.GetText(); }
0
7. Example
View licensepublic static string GetText() { // retry 2 times should be enough for read access try { return Clipboard.GetText(); } catch (ExternalException) { return Clipboard.GetText(); } }
0
8. Example
View licenseprivate void cmdPasteA_Click(object sender, EventArgs e) { txtTextA.Text = Clipboard.GetText(); }
0
9. Example
View licenseprivate void cmdPasteB_Click(object sender, EventArgs e) { txtTextB.Text = Clipboard.GetText(); }
0
10. Example
View licenseprivate void MultiplePaste() { ReadOnly = true; CurrentLine = Clipboard.GetText(); InputEnable = false; }
0
11. Example
View license[Test] public void RestrictedProcessShouldNotBeAbleToWriteToClipboard() { const string WriteToClipboardSourceCode = @"using System; using System.Windows.Forms; class Program { public static void Main() { Clipboard.SetText(""i did it""); } }"; var exePath = this.CreateExe("RestrictedProcessShouldNotBeAbleToWriteToClipboard.exe", WriteToClipboardSourceCode); var process = new RestrictedProcessExecutor(); var result = process.Execute(exePath, string.Empty, 1500, 32 * 1024 * 1024); Assert.IsNotNull(result); Assert.IsTrue(result.Type == ProcessExecutionResultType.RunTimeError, "No exception is thrown!"); Assert.AreNotEqual("i did it", Clipboard.GetText()); }
0
12. Example
View licensepublic static string GetClipboardText() { return System.Windows.Forms.Clipboard.GetText(); }
0
13. Example
View licenseprivate void pasteToolStripMenuItem_Click(object sender, EventArgs e) { if (AddressContextMenuOwner != null) AddressContextMenuOwner.Text = Clipboard.GetText(); else if (HistoryContextMenuOwner != null) HistoryContextMenuOwner.Text = Clipboard.GetText(); }
0
14. Example
View licenseprivate void btnSelectFolder_Click(object sender, EventArgs e) { fileFolderDialog.Dialog.Multiselect = true; fileFolderDialog.SelectedPath = Utils.GetBaseFolder(tbFolderName.Text); if (tbFolderName.Text == "") { string clipboard = Clipboard.GetText(); try { if (Path.IsPathRooted(clipboard)) fileFolderDialog.SelectedPath = clipboard; } catch (Exception ex) { // Ignore } } if (fileFolderDialog.ShowDialog() == DialogResult.OK) { if (fileFolderDialog.SelectedPaths != null) tbFolderName.Text = fileFolderDialog.SelectedPaths; else tbFolderName.Text = fileFolderDialog.SelectedPath; } }
0
15. Example
View licenseprivate void pasteToolStripMenuItem_Click(object sender, EventArgs e) { var l = new List<string>(Clipboard.GetText().Split(new[] {Environment.NewLine}, StringSplitOptions.None)); var i = data.SelectedCells[0].RowIndex; foreach (var s in l) { try { data.Rows[i].Cells[1].Value = s; i++; } catch { } } }
0
16. Example
View licensepublic static string GetURLOnClipboard() { string url = string.Empty; if (Clipboard.ContainsText()) { string tempUrl = Clipboard.GetText(); if (ResourceLocation.IsURL(tempUrl)) { url = tempUrl; } else { tempUrl = null; } } return url; }
0
17. Example
View licensepublic static string GetText() { if(!NativeLib.IsUnix()) // Windows return Clipboard.GetText(); if(NativeLib.GetPlatformID() == PlatformID.MacOSX) return GetStringM(); if(NativeLib.IsUnix()) return GetStringU(); Debug.Assert(false); return Clipboard.GetText(); }
0
18. Example
View licenseprivate static string GetStringU() { // string strGtk = GtkGetString(); // if(strGtk != null) return strGtk; // string str = NativeLib.RunConsoleApp("xclip", // "-out -selection clipboard"); // if(str != null) return str; string str = NativeLib.RunConsoleApp("xsel", "--output --clipboard", null, XSelFlags); if(str != null) return str; if(Clipboard.ContainsText()) return (Clipboard.GetText() ?? string.Empty); return string.Empty; }
0
19. Example
View licensepublic void FillServerClipboard() { FillServerClipboard(Clipboard.GetText()); }
0
20. Example
View licenseprivate void btnPaste_Click(object sender, EventArgs e) { if (Clipboard.GetText() != "") Write(Clipboard.GetText()); // Write the contents of the Clipboard text in the RichTextBox else wm.StartInfobox95("ERROR", "You need to have something in your clipboard to paste.", Engine.Template.InfoboxType.Error, Engine.Template.InfoboxButtons.OK); // Display an error message if the clipboard is null/empty }
0
21. Example
View licenseprivate void btnPaste_Click(object sender, EventArgs e) { if (Clipboard.ContainsText()) { txtAccessToken.Text = Clipboard.GetText(); } DialogResult = DialogResult.OK; }
0
22. Example
View licenseprivate void toolPaste_Click(object sender, EventArgs e) { InsertString(Clipboard.GetText()); }
0
23. Example
View licenseprivate void OnPasteClick(object sender, EventArgs e) { // HACK: If editing cell forward cut/copy/paste command // to editing control if (this.dataGridViewHostsEntries.IsCurrentCellInEditMode) { var keys = this.menuPaste.ShortcutKeys; this.menuPaste.ShortcutKeys = Keys.None; this.menuContextPaste.ShortcutKeys = Keys.None; SendKeys.SendWait("^(V)"); this.menuPaste.ShortcutKeys = keys; this.menuContextPaste.ShortcutKeys = keys; return; } this.dataGridViewHostsEntries.CancelEdit(); if (this.dataGridViewHostsEntries.SelectedRows.Count > 0 && this.clipboardEntries != null) { HostsFile.Instance.Entries.Insert( this.dataGridViewHostsEntries.CurrentHostEntry, this.clipboardEntries); this.clipboardEntries = null; } else { foreach ( DataGridViewCell cell in this.dataGridViewHostsEntries.SelectedCells) { if (cell.ValueType == typeof(string)) { cell.Value = Clipboard.GetText(); } } } }
0
24. Example
View licenseprivate void CheckClipboardURL() { if (Clipboard.ContainsText()) { string text = Clipboard.GetText(); if (URLHelpers.IsValidURL(text)) { txtURL.Text = text; } } }
0
25. Example
View licenseprivate void addParagraphAndPasteToolStripMenuItem_Click(object sender, EventArgs e) { addParagraphHereToolStripMenuItem_Click(sender, e); textBoxListViewText.Text = Clipboard.GetText(); }
0
26. Example
View licenseprivate TextContent getTextContentFromClipboard() { TextContent contentToReturn = new TextContent(); contentToReturn.index = view.TextRowCount + 1; contentToReturn.text = Clipboard.GetText(); contentToReturn.time = System.DateTime.Now.ToShortTimeString(); return contentToReturn; }
0
27. Example
View license[NotNull] public List<bool[,]> GetData() { var images = new List<bool[,]>(); try { var buffer = Clipboard.GetText(); var data = Serializer.Read<List<ExportedImage>>(buffer); if (data == null) return images; foreach (var exportedImage in data) { images.Add(ResourcePacksStorage.ReadImageFromAsciiString(exportedImage.Width, exportedImage.Height, exportedImage.DataString)); } return images; } catch { return images; } }
0
28. Example
View licensepublic QueryContext CreateQueryContext() { string textFromClipboard = Clipboard.GetText(); Parser parser = new Parser(textFromClipboard); DataTable dataTable = parser.ParseTable(); dataTable.TableName = "Clipboard"; Query query = new Query(); query.DataContext.Tables.Add(dataTable); query.Text = "SELECT * FROM Clipboard"; QueryContext queryContext = new QueryContext(query, "Clipboard"); return queryContext; }
0
29. Example
View licenseprivate void CheckClipboard() { if (cbClipboard.Visible && Properties.Settings.Default.CheckClipboard) { if (Clipboard.ContainsText()) { txtLinks.Text = Clipboard.GetText(); } } }
0
30. Example
View licenseprivate void contextMenu_Opened(object sender, EventArgs e) { pasteToolStripMenuItem.Enabled = File.Exists(Clipboard.GetText()); }
0
31. Example
View licensevoid grid_BeforePaste(object sender, BeforeRangeOperationEventArgs e) { if (chkPreventPasteEvent.Checked || chkCustomizePaste.Checked) { e.IsCancelled = true; if (chkCustomizePaste.Checked) { string text = Clipboard.GetText(); object[,] data = RGUtility.ParseTabbedString(text); // set a new range var applyRange = new RangePosition(worksheet.SelectionRange.Row, worksheet.SelectionRange.Col, data.GetLength(0), data.GetLength(1)); worksheet.SetRangeData(applyRange, data); worksheet.SetRangeStyles(applyRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.BackAll, BackColor = Color.Yellow, }); } } }
0
32. Example
View licensevoid grid_BeforePaste(object sender, BeforeRangeOperationEventArgs e) { if (chkPreventPasteEvent.Checked || chkCustomizePaste.Checked) { e.IsCancelled = true; if (chkCustomizePaste.Checked) { string text = Clipboard.GetText(); object[,] data = RGUtility.ParseTabbedString(text); // ??????????????? var applyRange = new RangePosition(worksheet.SelectionRange.Row, worksheet.SelectionRange.Col, data.GetLength(0), data.GetLength(1)); worksheet.SetRangeData(applyRange, data); worksheet.SetRangeStyles(applyRange, new WorksheetRangeStyle { Flag = PlainStyleFlag.BackAll, BackColor = Color.Yellow, }); } } }
0
33. Example
View licenseprivate static void GetClipboard() { Program.AssertOffEventThread(); try { if (Clipboard.ContainsText()) { string s = Clipboard.GetText(); if (s != ClipboardText) { ClipboardText = s; Program.Invoke(Program.MainWindow, OnClipboardChanged); } } } catch { } GettingClipboard = false; }
0
34. Example
View licensepublic void CopyClipboardToHistory() { CopyStringToHistory(Clipboard.GetText()); }
0
35. Example
View licensepublic void CopyClipboardToHistory() { CopyStringToHistory(Clipboard.GetText()); }
0
36. Example
View licenseprivate void pasteToolStripMenuItem1_Click(object sender, EventArgs e) { String[] sep = Clipboard.GetText().Split(new char[] { '\r', '\n' }); foreach (String entry in sep) { BreakpointCondition cond = BreakpointCondition.FromString(entry); if (cond != null) { bpHandler.conditions.Add(cond); } } }
0
37. Example
View licenseprotected override void WndProc(ref Message m) { switch (m.Msg) { case 0x302: //WM_PASTE { string text = Clipboard.GetText(); if (ValidateIPFromString(text)) this.Text = text; break; } } base.WndProc(ref m); }
0
38. Example
View licenseprivate void SetCommitExpressionFromClipboard() { string text = Clipboard.GetText().Trim(); if (text.IsNullOrEmpty()) { return; } string guid = Module.RevParse(text); if (!string.IsNullOrEmpty(guid)) { textboxCommitExpression.Text = text; textboxCommitExpression.SelectAll(); } }
0
39. Example
View licenseprivate void tsbpaste_Click(object sender, EventArgs e) { if (Clipboard.ContainsText()) txtsource.Text = Clipboard.GetText(); else MessageBox.Show(Functions.Translation("No text found in the clipboard") + ".", App.Name, MessageBoxButtons.OK, MessageBoxIcon.Information); }
0
40. Example
View licenseprivate void OnAddFromClipboardClick(object sender, EventArgs e) { string patch = null; try { patch = Clipboard.GetText(); } catch(Exception exc) { if(exc.IsCritical()) { throw; } } if(!string.IsNullOrWhiteSpace(patch)) { var src = new PatchFromString("Patch from clipboard", patch); AddPatchSource(src); } }
0
41. Example
View licensepublic ICopyObj PasteElements() { var clipboardText = Clipboard.GetText(); ICopyObj xx; if (clipboardText.Contains("\"CopyType\": 1")) { xx = JsonConvert.DeserializeObject<CopyColorsObj>(clipboardText); } else { xx = JsonConvert.DeserializeObject<CopyObject>(clipboardText); } return xx; }
0
42. Example
View licenseprivate static string LoadSourceText(Options options) { switch (options.MetadataSource) { case "CONS": return LoadSourceTextFromConsole(); case "CLIP": return Clipboard.GetText(); default: return File.ReadAllText(options.MetadataSource); } }
0
43. Example
View licenseprivate void test_syntax_form_Activated(object sender, EventArgs e) { if (ignore_) { // ignore first time - we're using the log lines from the existing log ignore_ = false; return; } // check clipboard - if non-empty, and more than 10 lines, use it string text = ""; try { text = Clipboard.GetText(); } catch { } text = util.normalize_enters(text); if (text.Split('\r').Length < LEAST_LINES) return; if (text == lines.Text) return; use_lines(text, syntax.Text); }
0
44. Example
View licenseprivate void ClickShowdownImportPKM(object sender, EventArgs e) { if (!Clipboard.ContainsText()) { WinFormsUtil.Alert("Clipboard does not contain text."); return; } // Get Simulator Data ShowdownSet Set = new ShowdownSet(Clipboard.GetText()); if (Set.Species < 0) { WinFormsUtil.Alert("Set data not found in clipboard."); return; } if (Set.Nickname?.Length > C_SAV.SAV.NickLength) Set.Nickname = Set.Nickname.Substring(0, C_SAV.SAV.NickLength); if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Import this set?", Set.Text)) return; if (Set.InvalidLines.Any()) WinFormsUtil.Alert("Invalid lines detected:", string.Join(Environment.NewLine, Set.InvalidLines)); // Set Species & Nickname PKME_Tabs.LoadShowdownSet(Set); }
0
45. Example
View licenseprivate void ClickShowdownExportPKM(object sender, EventArgs e) { if (!PKME_Tabs.VerifiedPKM()) { WinFormsUtil.Alert("Fix data before exporting."); return; } var text = PreparePKM().ShowdownText; Clipboard.SetText(text); var clip = Clipboard.GetText(); if (clip != text) WinFormsUtil.Alert("Unable to set to Clipboard.", "Try exporting again."); else WinFormsUtil.Alert("Exported Showdown Set to Clipboard:", text); }
0
46. Example
View licenseprivate void SearchWeb() { System.Collections.ObjectModel.ReadOnlyCollection<ClipData> clipData = ClipboardHandler.GetClipboard(); ExecuteKeyList(MouseAction.ModifierClick, m_location); System.Threading.Thread.Sleep(250); string text = Clipboard.GetText(); //ClipboardHandler.GetClipboardText(); Process myProcess = new Process(); myProcess.StartInfo.FileName = this.Details.Replace("(*)", text); myProcess.Start(); ClipboardHandler.SetClipboard(clipData); }
0
47. Example
View licenseprivate void CopyToClip() { //ReadOnlyCollection<ClipData> backup = ClipboardHandler.GetClipboard(); //ClipboardHandler.EmptyClipboard(); //KeyInput.ExecuteKeyInput(AllKeys.KEY_CONTROL_DOWN); //KeyInput.ExecuteKeyInput(AllKeys.KEY_C); //KeyInput.ExecuteKeyInput(AllKeys.KEY_CONTROL_UP); ExecuteKeyList(MouseAction.ModifierClick, m_location); System.Threading.Thread.Sleep(250); //SendKeys.SendWait("^c"); //Win32.SendMessage(hwnd, Win32.WM_COPY, 0, 0); int index = int.Parse(this.Details); Form_engine.PrivateTextClipboards[index] = Clipboard.GetText(); //Form_engine.PrivateClipboards[index] = ClipboardHandler.GetClipboard(); //ClipboardHandler.EmptyClipboard(); //ClipboardHandler.SetClipboard(backup); }
0
48. Example
View licenseprivate static void hook_KeyPressed(object sender, KeyPressedEventArgs e) { if (/n ..... /n //View Source file for more details /n }
0
49. Example
View licenseprivate void getClipboardData() { if (Clipboard.ContainsText()) { Regex isUrl = new Regex("^https?://|^www"); //if it begins with http:// or https:// or www Match URLtest = isUrl.Match(Clipboard.GetText()); if (URLtest.Success) //copy content from clipboard only if it begins with http:// or https:// or www { txtURL.Text = Clipboard.GetText(); } } }
0
50. Example
View licenseprivate void tsmiImportClipboard_Click(object sender, EventArgs e) { if (ImportRequested != null) { if (Clipboard.ContainsText()) { string json = Clipboard.GetText(); Import(json); } } }