System.Windows.Forms.Clipboard.SetText(string)

Here are the examples of the csharp api class System.Windows.Forms.Clipboard.SetText(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

200 Examples 7

151. Example

Project: WsdlUI
Source File: uc_TreeView.cs
private void copyUriToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string uri = tv_webServices.SelectedNode.Name;
            Clipboard.SetText(uri);
        }

152. Example

Project: EDDiscovery
Source File: UserControlRoute.cs
private void dataGridViewRoute_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewCell cell = dataGridViewRoute.CurrentCell;
            if (cell != null)
                Clipboard.SetText((string)cell.Value);        }

153. Example

Project: FOCA
Source File: Contextual.cs
public static void Global(TreeNode tn, Control sourceControl)
        {
            var tsiCopyClipboard = new ToolStripMenuItem("&Copy to clipboard") { Image = Resources.copytToClipboard };

            tsiCopyClipboard.Click += delegate { Clipboard.SetText(tn.Text); };

            Program.FormMainInstance.contextMenu.Items.Add(tsiCopyClipboard);
            Program.FormMainInstance.contextMenu.Items.Add(new ToolStripSeparator());

#if PLUGINS
            if (Program.FormMainInstance.ManagePluginsApi.lstContextGlobal.Count <= 0) return;
            foreach (
                var tsiPlugin in
                    Program.FormMainInstance.ManagePluginsApi.lstContextGlobal.Select(pluginMenu => pluginMenu.item))
            {
                tsiPlugin.Tag = tn.Tag;
                Program.FormMainInstance.contextMenu.Items.Add(tsiPlugin);
            }
#endif
        }

154. Example

Project: FOCA
Source File: PanelMetadataSearch.cs
private void toolStripMenuItemCopyToClipboard_Click(object sender, EventArgs e)
        {
            var links = string.Empty;
            for (var i = 0; i < listViewDocuments.SelectedItems.Count; i++)
            {
                //Add newlines
                links += i != 0 ? Environment.NewLine : string.Empty;
                links += listViewDocuments.SelectedItems[i].SubItems[2].Text;
            }
            Clipboard.SetText(links);
            Program.LogThis(new Log(Log.ModuleType.MetadataSearch,
                $"Copied to clipboard {listViewDocuments.SelectedItems.Count} URL documents",
                Log.LogType.debug));
        }

155. Example

Project: ACT.TPMonitor
Source File: ACTTabpageControl.cs
private void buttonCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(textBoxRecommend.Text);
        }

156. Example

Project: gitextensions
Source File: CommitInfo.cs
private void copyCommitInfoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var commitInfo = string.Empty;
            if (EnvUtils.IsMonoRuntime())
            {
                commitInfo = $"{_RevisionHeader.Text}{Environment.NewLine}{RevisionInfo.Text}";
            }
            else
            {
                commitInfo = $"{_RevisionHeader.GetPlaintText()}{Environment.NewLine}{RevisionInfo.GetPlaintText()}";
            }
            Clipboard.SetText(commitInfo);
        }

157. Example

Project: FunctionHacker
Source File: FunctionListViewer.cs
private void CopyToClipboard(int what)
        {
            if (functionList != null )
            {
                string text = string.Empty;
                for (int i = dataGridFunctions.SelectedRows.Count - 1; i >= 0; i--)
                {
                    int row = dataGridFunctions.Rows.IndexOf(dataGridFunctions.SelectedRows[i]);
                    switch (what)
                    {
                        case 1:
                            text += functionList.functions[row].address.ToString("X") + Environment.NewLine;
                            break;
                        case 2:
                            text += functionList.functions[row].name + Environment.NewLine;
                            break;
                        default:
                            text += functionList.functions[row].address.ToString("X") +
                                    "\t" + functionList.functions[row].name + Environment.NewLine;
                            break;
                    }
                }
                if (text != string.Empty)
                {
                    Clipboard.SetText(text);
                }
            }
        }

158. Example

Project: Grevit
Source File: ParameterList.cs
private void copyID_Click(object sender, EventArgs e)
        {
            if (parameters.SelectedItems.Count == 1)
            {
                string elementId = parameters.SelectedItems[0].SubItems[0].Text;
                Clipboard.SetText(elementId);
            }
        }

159. Example

Project: Grevit
Source File: ParameterList.cs
private void copyName_Click(object sender, EventArgs e)
        {
            if (parameters.SelectedItems.Count == 1)
            {
                string name = parameters.SelectedItems[0].SubItems[1].Text;
                Clipboard.SetText(name);
            }
        }

160. Example

Project: Rosin
Source File: JsonViewer.cs
private void btnCopy_Click(object sender, EventArgs e)
        {
            string text;
            if (txtJson.SelectionLength > 0)
                text = txtJson.SelectedText;
            else
                text = txtJson.Text;
            Clipboard.SetText(text);
        }

161. Example

Project: VSIXPowerToys
Source File: VsixPowerToys.cs
private void CopyVsixIdToClipboard()
        {
            Clipboard.SetText(vsix.Header.Identifier);
        }

162. Example

Project: Kuriimu
Source File: Extension.cs
private void copyOffsetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (lstStatus.SelectedItem != null && lstStatus.SelectedItem.GetType() == typeof(ListItem))
                Clipboard.SetText((string)((ListItem)lstStatus.SelectedItem).Value);
        }

163. Example

Project: Kuriimu
Source File: Extension.cs
private void lstStatus_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control & e.KeyCode == Keys.C)
                if (lstStatus.SelectedItem != null && lstStatus.SelectedItem.GetType() == typeof(ListItem))
                    Clipboard.SetText((string)((ListItem)lstStatus.SelectedItem).Value);
        }

164. Example

Project: AuthorizationServer
Source File: Program.cs
private static void SetClipboard(string text)
        {
            Clipboard.SetText(text);
        }

165. Example

Project: opentheatre
Source File: ctrlStreamInfo.cs
private void imgCopyURL_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(infoFileURL);
            imgCopyURL.Image = Properties.Resources.clipboard_check;
        }

166. Example

Project: ElectronicObserver
Source File: FormHeadquarters.cs
private void Resource_MouseDoubleClick(object sender, MouseEventArgs e)
		{
			if (e.Button == MouseButtons.Left)
			{
				try
				{
					var mat = KCDatabase.Instance.Material;
					Clipboard.SetText($"{mat.Fuel}/{mat.Ammo}/{mat.Steel}/{mat.Bauxite}/??{mat.InstantRepair}/??{mat.DevelopmentMaterial}/??{mat.InstantConstruction}/??{mat.ModdingMaterial}");
				}
				catch (Exception ex)
				{
					Utility.Logger.Add(3, "???????????????????????" + ex.Message);
				}
			}
		}

167. Example

Project: IFME
Source File: frmAbout.cs
private void lblDonateBTC_Click(object sender, EventArgs e)
		{
			Clipboard.SetText("12LWHDCPShFvYh6vxxeMsntejAUm8y8rFN");
			lblDonateBTC.ForeColor = Color.Purple;
		}

168. Example

Project: IFME
Source File: frmAbout.cs
private void lblDonateETH_Click(object sender, EventArgs e)
		{
			Clipboard.SetText("0xAdd9ba89B601e7CB5B3602643337B9db8c90EFe0");
			lblDonateETH.ForeColor = Color.Purple;
		}

169. Example

Project: FileHelpers
Source File: frmWizard.cs
private void cmdToClipboard_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(mLastTemplateCode);
        }

170. Example

Project: FileHelpers
Source File: frmWizard.cs
private void cmdCopyClass_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(mLastCode);
        }

171. Example

Project: Captura
Source File: Extensions.cs
public static void WriteToClipboard(this string S)
        {
            if (S == null)
                return;

            try { Clipboard.SetText(S); }
            catch (ExternalException)
            {
                ServiceProvider.MessageProvider?.ShowError($"Copy to Clipboard failed:\n\n{S}");
            }
        }

172. Example

Project: vs-customize-window-title
Source File: SupportedTagsGrid.cs
public void CopyTag(string tag) {
            try {
                Clipboard.SetText("[" + tag + "]");
            }
            catch {
                // Do nothing
            }
        }

173. Example

Project: Pass4Win
Source File: Genpass.cs
private void BtnCopyClick(object sender, EventArgs e)
        {
            if (txtGenPass.Text != null)
            {
                Clipboard.SetText(new string(txtGenPass.Text.TakeWhile(c => c != '\n').ToArray()));
            }
        }

174. Example

Project: MOSA-Project
Source File: MainForm.cs
public void OnCopyToClipboard(Object sender, EventArgs e)
		{
			var text = (sender as Menu).Tag as string;

			Clipboard.SetText(text);
		}

175. Example

Project: Tibialyzer
Source File: SummaryForm.cs
private void CopyLootText(object sender, EventArgs e) {
            Clipboard.SetText((sender as Control).Name);
        }

176. Example

Project: Tibialyzer
Source File: SimpleLootNotification.cs
private void CopyLootText(object sender, EventArgs e) {
            Clipboard.SetText((sender as Control).Name);
        }

177. Example

Project: cardmaker
Source File: MDIDefines.cs
private void copyDefineAsReferenceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (1 == listViewDefines.SelectedItems.Count)
            {
                Clipboard.SetText($"@[{listViewDefines.SelectedItems[0].SubItems[0].Text}]");
            }
        }

178. Example

Project: nHydrate
Source File: StaticDataForm.cs
private void cmdCopy_Click(object sender, EventArgs e)
        {
            var text = "";
            var table = (DataTable)this.dataGridView1.DataSource;
            var jj = 0;
            foreach (DataRow dr in table.Rows)
            {
                for (var ii = 0; ii < table.Columns.Count; ii++)
                {
                    text += dr[ii];
                    if (ii < table.Columns.Count - 1)
                        text += "\t";
                }

                if (jj < table.Rows.Count - 1)
                    text += "\n";

                jj++;
            }
            Clipboard.SetText(text);
        }

179. Example

Project: nHydrate
Source File: RowEntryCollectionForm.cs
private void cmdCopy_Click(object sender, EventArgs e)
		{
			var text = string.Empty;
			var table = (DataTable)this.dataGridView1.DataSource;
			var jj = 0;
			foreach (DataRow dr in table.Rows)
			{
				for (var ii = 0; ii < table.Columns.Count; ii++)
				{
					text += dr[ii];
					if (ii < table.Columns.Count - 1)
						text += "\t";
				}

				if (jj < table.Rows.Count - 1)
					text += "\n";

				jj++;
			}
			Clipboard.SetText(text);
		}

180. Example

Project: RestrictedProcess.NET
Source File: RestrictedProcessSecurityTests.cs
[Test]
        [Ignore("System.Threading.ThreadStateException : Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it.")]
        [STAThread]
        public void RestrictedProcessShouldNotBeAbleToReadClipboard()
        {
            const string ReadClipboardSourceCode = @"using System;
using System.Windows.Forms;
class Program
{
    public static void Main()
    {
        if (string.IsNullOrEmpty(Clipboard.GetText()))
        {
            throw new Exception(""Clipboard empty!"");
        }
    }
}";
            Clipboard.SetText("clipboard test");
            var exePath = this.CreateExe("RestrictedProcessShouldNotBeAbleToReadClipboard.exe", ReadClipboardSourceCode);

            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!");
        }

181. Example

Project: monogameui
Source File: SystemSpecific.cs
public static void SetClipboardText(string text)
        {
            System.Windows.Forms.Clipboard.SetText(text);
        }

182. Example

Project: ObjectExporter
Source File: FormDisplayGeneratedText.cs
private void buttonCopyToClipboard_Click(object sender, EventArgs e)
        {
            string expressionName = radPageViewGeneratedText.SelectedPage.Text;

            var expressionText = _dicTexts[expressionName];
            Clipboard.SetText(expressionText);
        }

183. Example

Project: onedrive-sample-apibrowser-dotnet
Source File: OneDriveObjectBrowser.cs
private void copyValueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == treeViewProperties.SelectedNode) return;

            string value = treeViewProperties.SelectedNode.Tag as string;
            if (null != value)
            {
                System.Windows.Forms.Clipboard.SetText(value);
            }
        }

184. Example

Project: onedrive-sample-apibrowser-dotnet
Source File: OneDriveObjectBrowser.cs
private void copyRowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == treeViewProperties.SelectedNode) return;

            string value = treeViewProperties.SelectedNode.Text;
            if (null != value)
            {
                System.Windows.Forms.Clipboard.SetText(value);
            }
        }

185. Example

Project: QuasarRAT
Source File: ClipboardHelper.cs
public static void SetClipboardText(string text)
        {
            try
            {
                Clipboard.SetText(text);
            }
            catch (Exception)
            {
            }
        }

186. Example

Project: scada
Source File: FrmMain.cs
private void lbLog_KeyDown(object sender, KeyEventArgs e)
        {
            // ??????????? ????????? ?????? ???????
            ListBox listBox = (ListBox)sender;
            if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control)
            {
                lock (listBox)
                {
                    if (listBox.SelectedIndex >= 0)
                    {
                        string text = listBox.Items[listBox.SelectedIndex] as string ?? "";
                        if (text != "")
                            Clipboard.SetText(text);
                    }
                }
            }
        }

187. Example

Project: ShadowsocksR-Csharp
Source File: MenuViewController.cs
private void CopyPACURLItem_Click(object sender, EventArgs e)
        {
            try
            {
                Configuration config = controller.GetCurrentConfiguration();
                string pacUrl;
                pacUrl = "http://127.0.0.1:" + config.localPort.ToString() + "/pac?" + "auth=" + config.localAuthPassword + "&t=" + Util.Utils.GetTimestamp(DateTime.Now);
                Clipboard.SetText(pacUrl);
            }
            catch
            {

            }
        }

188. Example

Project: ShadowsocksR-Csharp
Source File: ServerLogForm.cs
private void copyLinkItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            if (config.index >= 0 && config.index < config.configs.Count)
            {
                try
                {
                    string link = config.configs[config.index].GetSSRLinkForServer();
                    Clipboard.SetText(link);
                }
                catch { }
            }
        }

189. Example

Project: ShadowsocksR-Csharp
Source File: ServerLogForm.cs
private void copyGroupLinkItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            if (config.index >= 0 && config.index < config.configs.Count)
            {
                string group = config.configs[config.index].group;
                string link = "";
                for (int index = 0; index < config.configs.Count; ++index)
                {
                    if (config.configs[index].group != group)
                        continue;
                    link += config.configs[index].GetSSRLinkForServer() + "\r\n";
                }
                try
                {
                    Clipboard.SetText(link);
                }
                catch { }
            }
        }

190. Example

Project: ShadowsocksR-Csharp
Source File: ServerLogForm.cs
private void copyEnableLinksItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            string link = "";
            for (int index = 0; index < config.configs.Count; ++index)
            {
                if (!config.configs[index].enable)
                    continue;
                link += config.configs[index].GetSSRLinkForServer() + "\r\n";
            }
            try
            {
                Clipboard.SetText(link);
            }
            catch { }
        }

191. Example

Project: ShadowsocksR-Csharp
Source File: ServerLogForm.cs
private void copyLinksItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            string link = "";
            for (int index = 0; index < config.configs.Count; ++index)
            {
                link += config.configs[index].GetSSRLinkForServer() + "\r\n";
            }
            try
            {
                Clipboard.SetText(link);
            }
            catch { }
        }

192. Example

Project: Repetier-Host
Source File: LogView.cs
private void toolCopy_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            string sel = listLog.getSelection();
            if(sel.Length>0)
                Clipboard.SetText(sel);
        }

193. Example

Project: shadowsocksr-csharp
Source File: MenuViewController.cs
private void CopyPACURLItem_Click(object sender, EventArgs e)
        {
            try
            {
                Configuration config = controller.GetCurrentConfiguration();
                string pacUrl;
                pacUrl = "http://127.0.0.1:" + config.localPort.ToString() + "/pac?" + "auth=" + config.localAuthPassword + "&t=" + Util.Utils.GetTimestamp(DateTime.Now);
                Clipboard.SetText(pacUrl);
            }
            catch
            {

            }
        }

194. Example

Project: shadowsocksr-csharp
Source File: ServerLogForm.cs
private void copyLinkItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            if (config.index >= 0 && config.index < config.configs.Count)
            {
                try
                {
                    string link = config.configs[config.index].GetSSRLinkForServer();
                    Clipboard.SetText(link);
                }
                catch { }
            }
        }

195. Example

Project: shadowsocksr-csharp
Source File: ServerLogForm.cs
private void copyGroupLinkItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            if (config.index >= 0 && config.index < config.configs.Count)
            {
                string group = config.configs[config.index].group;
                string link = "";
                for (int index = 0; index < config.configs.Count; ++index)
                {
                    if (config.configs[index].group != group)
                        continue;
                    link += config.configs[index].GetSSRLinkForServer() + "\r\n";
                }
                try
                {
                    Clipboard.SetText(link);
                }
                catch { }
            }
        }

196. Example

Project: shadowsocksr-csharp
Source File: ServerLogForm.cs
private void copyEnableLinksItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            string link = "";
            for (int index = 0; index < config.configs.Count; ++index)
            {
                if (!config.configs[index].enable)
                    continue;
                link += config.configs[index].GetSSRLinkForServer() + "\r\n";
            }
            try
            {
                Clipboard.SetText(link);
            }
            catch { }
        }

197. Example

Project: shadowsocksr-csharp
Source File: ServerLogForm.cs
private void copyLinksItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            string link = "";
            for (int index = 0; index < config.configs.Count; ++index)
            {
                link += config.configs[index].GetSSRLinkForServer() + "\r\n";
            }
            try
            {
                Clipboard.SetText(link);
            }
            catch { }
        }

198. Example

Project: shadowsocksr-csharp
Source File: MenuViewController.cs
private void CopyPACURLItem_Click(object sender, EventArgs e)
        {
            try
            {
                Configuration config = controller.GetCurrentConfiguration();
                string pacUrl;
                pacUrl = "http://127.0.0.1:" + config.localPort.ToString() + "/pac?" + "auth=" + config.localAuthPassword + "&t=" + Util.Utils.GetTimestamp(DateTime.Now);
                Clipboard.SetText(pacUrl);
            }
            catch
            {

            }
        }

199. Example

Project: shadowsocksr-csharp
Source File: ServerLogForm.cs
private void copyLinkItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            if (config.index >= 0 && config.index < config.configs.Count)
            {
                try
                {
                    string link = config.configs[config.index].GetSSRLinkForServer();
                    Clipboard.SetText(link);
                }
                catch { }
            }
        }

200. Example

Project: shadowsocksr-csharp
Source File: ServerLogForm.cs
private void copyGroupLinkItem_Click(object sender, EventArgs e)
        {
            Configuration config = controller.GetCurrentConfiguration();
            if (config.index >= 0 && config.index < config.configs.Count)
            {
                string group = config.configs[config.index].group;
                string link = "";
                for (int index = 0; index < config.configs.Count; ++index)
                {
                    if (config.configs[index].group != group)
                        continue;
                    link += config.configs[index].GetSSRLinkForServer() + "\r\n";
                }
                try
                {
                    Clipboard.SetText(link);
                }
                catch { }
            }
        }