System.Windows.Forms.Clipboard.Clear()

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

106 Examples 7

1. Example

Project: DNTLive
Source File: MainForm.cs
View license
private void ClearClipboard()
        {
            Clipboard.Clear();
        }

2. Example

Project: RevitLookup
Source File: Objects.cs
View license
private void
    CopyToolStripMenuItem_Click( object sender, System.EventArgs e )
    {
      if( m_lvData.SelectedItems.Count > 0 )
      {
        Utils.CopyToClipboard( m_lvData.SelectedItems[0], false );
      }
      else
      {
        Clipboard.Clear();
      }
    }

3. Example

Project: RevitLookup
Source File: ObjTreeBase.cs
View license
private void
        CopyToolStripMenuItem_Click (object sender, System.EventArgs e)
        {
            if (m_lvData.SelectedItems.Count > 0)
            {
                Utils.CopyToClipboard(m_lvData.SelectedItems[0], false);
            }
            else
            {
                Clipboard.Clear();
            }
        }

4. Example

Project: RevitLookup
Source File: ParamEnum.cs
View license
private void
        CopyToolStripMenuItem_Click (object sender, System.EventArgs e)
        {
            if (m_listView.SelectedItems.Count > 0)
            {
                Utils.CopyToClipboard(m_listView.SelectedItems[0], true);
            }
            else
            {
                Clipboard.Clear();
            }
        }

5. Example

Project: RevitLookup
Source File: ParamEnumSnoop.cs
View license
private void
        CopyToolStripMenuItem_Click (object sender, EventArgs e)
        {            
            if (m_lvData.SelectedItems.Count > 0)
            {
                Utils.CopyToClipboard(m_lvData.SelectedItems[0], false);
            }
            else
            {
                Clipboard.Clear();
            }
        }

6. Example

Project: RevitLookup
Source File: Parameters.cs
View license
private void
        CopyToolStripMenuItem_Click (object sender, EventArgs e)
        {            
            if (m_lvData.SelectedItems.Count > 0)
            {
                Utils.CopyToClipboard(m_lvData.SelectedItems[0], false);
            }
            else
            {
                Clipboard.Clear();
            }
        }

7. Example

View license
public static void Clear()
        {
            Clipboard.Clear();
        }

8. Example

View license
public static void Clear()
        {
            Clipboard.Clear();
        }

9. Example

Project: Pass4Win
Source File: Main.cs
View license
private void ClipBoardClearThread()
        {
            Clipboard.Clear();
            statusPB.Visible = false;
            statusTxt.Text = Strings.Ready;
            statusPB.Value = 0;
            btnMakeVisible.Visible = true;
            txtPassDetail.Visible = false;
        }

10. Example

Project: mwinapi
Source File: MainForm.cs
View license
private void clearClipboardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
        }

11. Example

Project: monogameui
Source File: SystemSpecific.cs
View license
public static void ClearClipboard()
        {
            System.Windows.Forms.Clipboard.Clear();
        }

12. Example

Project: Clipboarder
Source File: MainForm.cs
View license
private void clearClipboardMenuItem_Click(object sender, EventArgs e) {
            Clipboard.Clear();
        }

13. Example

Project: Clipboarder
Source File: MainForm.cs
View license
private void clearClipboardMenuItem_Click_1(Object sender, EventArgs e) {
            Clipboard.Clear();
        }

14. Example

Project: Clipboarder
Source File: MainForm.cs
View license
private void clearClipboardToolStripMenuItem_Click(object sender, EventArgs e) {
            Clipboard.Clear();
        }

15. Example

Project: Wolven-kit
Source File: frmChunkList.cs
View license
private void copyChunkToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
            var chunks = listView.SelectedObjects.Cast<CR2WChunk>().ToList();
            CopyController.ChunkList = chunks;
            pasteChunkToolStripMenuItem.Enabled = true;
        }

16. Example

Project: ImageGlass
Source File: frmMain.cs
View license
private void mnuMainClearClipboard_Click(object sender, EventArgs e)
        {
            //clear copied files in clipboard
            if (GlobalSetting.StringClipboard.Count > 0)
            {
                GlobalSetting.StringClipboard = new StringCollection();
                Clipboard.Clear();
                DisplayTextMessage(GlobalSetting.LangPack.Items["frmMain._ClearClipboard"], 1000);
            }
        }

17. Example

View license
void copyMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
            ListView parent = (ListView)menuItem.Tag;
            int columnIndex = -1;

            for (int i = 0; i < parent.Columns.Count; i++)
            {
                if (parent.Columns[i].Text == menuItem.Text)
                {
                    columnIndex = i;
                    continue;
                }
            }

            if (columnIndex == -1) return;
            if (parent.SelectedItems.Count != 1) return;

            if (columnIndex < parent.SelectedItems[0].SubItems.Count)
                Clipboard.SetText(parent.SelectedItems[0].SubItems[columnIndex].Text);
            else
                Clipboard.Clear();
        }

18. Example

Project: RevitLookup
Source File: Utils.cs
View license
public static void
      CopyToClipboard(ListViewItem lvItem, Boolean multipleItems)
      {
         if (lvItem.SubItems.Count > 1)
         {
            if (!multipleItems)
            {
               Clipboard.SetDataObject(lvItem.SubItems[1].Text);
            }
            else
            {
               Clipboard.SetDataObject(lvItem.SubItems[0].Text + " => " + lvItem.SubItems[1].Text);
            }
         }
         else
         {
            Clipboard.Clear();
         }

      }

19. Example

Project: openvpn-manager
Source File: IPLabel.cs
View license
private void copyIPToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
            Clipboard.SetText(ip, TextDataFormat.Text);
        }

20. Example

Project: RTVS
Source File: RPackageSourceViewModel.cs
View license
public void CopyToClipboard() {
            Clipboard.Clear();
            Clipboard.SetText(Source);
        }

21. Example

View license
private static void CopySelectedItem(PackageSource selectedPackageSource)
        {
            Clipboard.Clear();
            Clipboard.SetText(selectedPackageSource.Source);
        }

22. Example

Project: MultiversePlatform
Source File: WorldEditor.cs
View license
public void copyToClipboardMenuButton_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.Clipboard.Clear();
            string copyString = "";

            if (SelectedObject.Count > 0)
            {
                foreach (IWorldObject obj in SelectedObject)
                {
                    copyString += obj.ObjectAsString;
                }
                System.Windows.Forms.Clipboard.SetText(copyString);
            }
        }

23. Example

Project: mwinapi
Source File: MainForm.cs
View license
private void hideButton_Click(object sender, EventArgs e)
        {
            Keys mask = Keys.Shift | Keys.Control;
            if ((Control.ModifierKeys & mask) == mask)
            {
                Clipboard.Clear();
                Clipboard.SetText(settings.Settings);
            }
            Visible = false;
        }

24. Example

Project: mwinapi
Source File: MainFormPaintDotNet.cs
View license
private void hideButton_Click(object sender, EventArgs e)
        {
            Keys mask = Keys.Shift | Keys.Control;
            if ((Control.ModifierKeys & mask) == mask)
            {
                Clipboard.Clear();
                Clipboard.SetText(settings.Settings);
            }
            Visible = false;
        }

25. Example

Project: mwinapi
Source File: ScreenshotForm.cs
View license
private void copyButton_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
            Clipboard.SetImage(picture.Image);
        }

26. Example

Project: BitChatClient
Source File: frmChatProperties.cs
View license
private void copyTrackerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string trackers = "";

            lock (lstTrackerInfo.Items)
            {
                foreach (ListViewItem item in lstTrackerInfo.SelectedItems)
                {
                    TrackerClient tracker = item.Tag as TrackerClient;

                    if (tracker != null)
                        trackers += tracker.TrackerUri.AbsoluteUri + "\r\n";
                }
            }

            if (trackers != "")
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(trackers);
                }
                catch
                { }
            }
        }

27. Example

Project: BitChatClient
Source File: frmChatProperties.cs
View license
private void copyAllTrackersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string trackers = "";

            lock (lstTrackerInfo.Items)
            {
                foreach (ListViewItem item in lstTrackerInfo.Items)
                {
                    TrackerClient tracker = item.Tag as TrackerClient;

                    if (tracker != null)
                        trackers += tracker.TrackerUri.AbsoluteUri + "\r\n";
                }
            }

            if (trackers != "")
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(trackers);
                }
                catch
                { }
            }
        }

28. Example

Project: BitChatClient
Source File: frmViewGroup.cs
View license
private void mnuCopy_Click(object sender, EventArgs e)
        {
            try
            {
                Clipboard.Clear();
                Clipboard.SetText(labName.Text);
            }
            catch
            { }
        }

29. Example

Project: BitChatClient
Source File: frmViewProfile.cs
View license
private void mnuCopy_Click(object sender, EventArgs e)
        {
            Label label = mnuCopyUtility.Tag as Label;

            if (label != null)
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(label.Text);
                }
                catch
                { }
            }
        }

30. Example

Project: BitChatClient
Source File: frmChatProperties.cs
View license
private void copyTrackerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string trackers = "";

            lock (lstTrackerInfo.Items)
            {
                foreach (ListViewItem item in lstTrackerInfo.SelectedItems)
                {
                    TrackerClient tracker = item.Tag as TrackerClient;

                    if (tracker != null)
                        trackers += tracker.TrackerUri.AbsoluteUri + "\r\n";
                }
            }

            if (trackers != "")
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(trackers);
                }
                catch
                { }
            }
        }

31. Example

Project: BitChatClient
Source File: frmChatProperties.cs
View license
private void copyAllTrackersToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string trackers = "";

            lock (lstTrackerInfo.Items)
            {
                foreach (ListViewItem item in lstTrackerInfo.Items)
                {
                    TrackerClient tracker = item.Tag as TrackerClient;

                    if (tracker != null)
                        trackers += tracker.TrackerUri.AbsoluteUri + "\r\n";
                }
            }

            if (trackers != "")
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(trackers);
                }
                catch
                { }
            }
        }

32. Example

Project: BitChatClient
Source File: frmViewGroup.cs
View license
private void mnuCopy_Click(object sender, EventArgs e)
        {
            try
            {
                Clipboard.Clear();
                Clipboard.SetText(labName.Text);
            }
            catch
            { }
        }

33. Example

Project: BitChatClient
Source File: frmViewProfile.cs
View license
private void mnuCopy_Click(object sender, EventArgs e)
        {
            Label label = mnuCopyUtility.Tag as Label;

            if (label != null)
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetText(label.Text);
                }
                catch
                { }
            }
        }

34. Example

View license
private static void CopySelectedItem(PackageSource selectedPackageSource)
        {
            Clipboard.Clear();
            Clipboard.SetText(selectedPackageSource.Source);
        }

35. Example

View license
public void CopyToClipBoard()
        {
            if (String.IsNullOrEmpty(_textContent.Text))
            {
                Clipboard.Clear();
                return;
            }

            Clipboard.SetText(_textContent.Text);

            return;
        }

36. Example

View license
public void CopyToClipBoard()
        {
            if (String.IsNullOrEmpty(_textContent.Text))
            {
                Clipboard.Clear();
                return;
            }

            Clipboard.SetText(_textContent.Text);

            return;
        }

37. Example

View license
public void CopyToClipBoard()
        {
            if (String.IsNullOrEmpty(_textContent.Text))
            {
                Clipboard.Clear();
                return;
            }

            Clipboard.SetText(_textContent.Text);

            return;
        }

38. Example

View license
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
    {
      try
      {
        Clipboard.Clear();
        Clipboard.SetImage(imageBox.GetSelectedImage() ?? imageBox.Image);
      }
      catch (Exception ex)
      {
        MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
      }
    }

39. Example

Project: SeleniumBasic
Source File: Image.cs
View license
public IRange ToExcel(object target = null, bool autoDispose = true) {
            IRange range = ExcelExt.GetRange(target);
            Clipboard.SetDataObject(_bitmap, false);
            range.Worksheet.Paste(range, _bitmap);
            Clipboard.Clear();
            if (autoDispose)
                _bitmap.Dispose();
            return range;
        }

40. Example

Project: gitextensions
Source File: HtmlFragment.cs
View license
public static void CopyToClipboard(string htmlFragment, string title, Uri sourceUri)
        {
            var dataObject = CreateHtmlFormatClipboardDataObject(htmlFragment, title, sourceUri);
            Clipboard.Clear();
            Clipboard.SetDataObject(dataObject);
            // now the clipboard can be pasted as text (HTML code) to text editor
            // or as table to MS Word or LibreOffice Writer
        }

41. Example

Project: KeeThief
Source File: ClipboardUtil.cs
View license
public static void Clear()
		{
			// Ensure that there's no infinite recursion
			if(!g_csClearing.TryEnter()) { Debug.Assert(false); return; }

			// In some situations (e.g. when running in a VM, when using
			// a clipboard extension utility, ...) the clipboard cannot
			// be cleared; for this case we first overwrite the clipboard
			// with a non-sensitive text
			try { Copy("--", false, false, null, null, IntPtr.Zero); }
			catch(Exception) { Debug.Assert(false); }

			bool bNativeSuccess = false;
			try
			{
				if(!NativeLib.IsUnix()) // Windows
				{
					if(OpenW(IntPtr.Zero, true)) // Clears the clipboard
					{
						CloseW();
						bNativeSuccess = true;
					}
				}
				else if(NativeLib.GetPlatformID() == PlatformID.MacOSX)
				{
					SetStringM(string.Empty);
					bNativeSuccess = true;
				}
				else if(NativeLib.IsUnix())
				{
					SetStringU(string.Empty);
					bNativeSuccess = true;
				}
			}
			catch(Exception) { Debug.Assert(false); }

			g_csClearing.Exit();

			if(bNativeSuccess) return;

			try { Clipboard.Clear(); } // Fallback to .NET framework method
			catch(Exception) { Debug.Assert(false); }
		}

42. Example

Project: tfsprod
Source File: MergeWIControl.cs
View license
private void toolDClipboard_Click(object sender, EventArgs e)
        {
            string res = String.Format("Changeset={0}, WorkItem={1}, Date={2}, ServerPath={3}", ClickedItem.ChangesetID, ClickedItem.WorkitemID, ClickedItem.date, ClickedItem.sourcePath);

            Clipboard.Clear();
            Clipboard.SetDataObject(res, true);
        }

43. Example

Project: mwinapi
Source File: ClipboardEntry.cs
View license
internal void CopyToClipboard()
        {
            if (empty)
            {
                Clipboard.Clear();
            }
            else
            {
                DataObject o = new DataObject();
                foreach (KeyValuePair<string, object> p in entries)
                {
                    o.SetData(p.Key, false, p.Value);
                }
                Clipboard.SetDataObject(o, true);
            }
        }

44. Example

Project: SharpMap
Source File: MapBox.cs
View license
protected override void OnKeyDown(KeyEventArgs e)
        {
#if EnableMetafileClipboardSupport
            if (e.Control && e.KeyCode == Keys.C)
            {
                Clipboard.Clear();
                ClipboardMetafileHelper.PutEnhMetafileOnClipboard(Handle, _map.GetMapAsMetafile());
                e.Handled = true;
            }
#endif

            if (UseCurrentTool)
            {
                _currentTool.DoKeyDown(_map.ImageToWorld(MousePosition), e);
            }
            base.OnKeyDown(e);
        }

45. Example

Project: winauth
Source File: WinAuthForm.cs
View license
public void SetClipboardData(object data)
		{
			bool clipRetry = false;
			do
			{
				try
				{
					Clipboard.Clear();
					Clipboard.SetDataObject(data, true, 4, 250);
				}
				catch (ExternalException)
				{
					// only show an error the first time
					clipRetry = (MessageBox.Show(this, strings.ClipboardInUse,
						WinAuthMain.APPLICATION_NAME,
						MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes);
				}
			}
			while (clipRetry == true);
		}

46. Example

Project: AutoTest.Net
Source File: StackTraceDisplay.cs
View license
public void CopyToClipBoard()
        {
            if (String.IsNullOrEmpty(_textContent.Text))
            {
                Clipboard.Clear();
                return;
            }

            Clipboard.SetText(_textContent.Text);

            return;
        }

47. Example

Project: AutoTest.Net
Source File: StackTraceDisplay.cs
View license
public void CopyToClipBoard()
        {
            if (String.IsNullOrEmpty(_textContent.Text))
            {
                Clipboard.Clear();
                return;
            }

            Clipboard.SetText(_textContent.Text);

            return;
        }

48. Example

Project: AutoTest.Net
Source File: StackTraceDisplay.cs
View license
public void CopyToClipBoard()
        {
            if (String.IsNullOrEmpty(_textContent.Text))
            {
                Clipboard.Clear();
                return;
            }

            Clipboard.SetText(_textContent.Text);

            return;
        }

49. Example

Project: tcp-gecko-dotnet
Source File: MainForm.cs
View license
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Clipboard.Clear();
            String clipboardText = String.Empty;
            foreach (DataGridViewRow row in SearchResults.SelectedRows)
            {
                for (int i = 0; i < SearchResults.ColumnCount; i++)
                {
                    clipboardText += row.Cells[i].Value.ToString();
                    if (i + 1 < SearchResults.ColumnCount)
                    {
                        clipboardText += "\t";
                    }
                    else
                    {
                        clipboardText += "\r\n";
                    }
                }
            }
            Clipboard.SetText(clipboardText);
        }

50. Example

Project: duality
Source File: AboutBox.cs
View license
private void labelVersion_Click(object sender, EventArgs e)
		{
			System.Media.SystemSounds.Asterisk.Play();
			Clipboard.Clear();
			Clipboard.SetText(this.labelVersion.Text);
		}