System.Windows.Forms.Clipboard.SetDataObject(object)

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

67 Examples 7

1. Example

Project: ContinuousTests
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

2. Example

Project: ContinuousTests
Source File: ExpandingTextBox.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

3. Example

Project: ContinuousTests
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

4. Example

Project: ContinuousTests
Source File: ExpandingTextBox.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

5. Example

Project: ContinuousTests
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

6. Example

Project: ContinuousTests
Source File: ExpandingTextBox.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

7. Example

Project: nunit-gui
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

8. Example

Project: GEDKeeper
Source File: CalcWidget.cs
private void edExpression_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                string res;
                try
                {
                    res = fCalc.Calc(edExpression.Text).ToString();
                    if (chkPutToClipboard.Checked)
                    {
                        Clipboard.SetDataObject(res);
                    }
                }
                catch (Exception)
                {
                    res = "[ ??? ]";
                }
                lbOutput.Items.Add("> " + edExpression.Text);
                lbOutput.Items.Add("= " + res);
                lbOutput.SelectedIndex = lbOutput.Items.Count - 1;
                edCalcResult.Text = res;
            }
        }

9. Example

Project: AutoTest.Net
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

10. Example

Project: AutoTest.Net
Source File: ExpandingTextBox.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

11. Example

Project: AutoTest.Net
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

12. Example

Project: AutoTest.Net
Source File: ExpandingTextBox.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

13. Example

Project: AutoTest.Net
Source File: ExpandingLabel.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

14. Example

Project: AutoTest.Net
Source File: ExpandingTextBox.cs
private void CopyToClipboard( object sender, EventArgs e )
		{
			Clipboard.SetDataObject( this.Text );
		}

15. Example

Project: TweetDuck
Source File: WindowsUtils.cs
private static void SetClipboardData(DataObject obj){
            try{
                Clipboard.SetDataObject(obj);
            }catch(ExternalException e){
                Program.Reporter.HandleException("Clipboard Error", "TweetDuck could not access the clipboard as it is currently used by another process.", true, e);
            }
        }

16. Example

Project: ContinuousTests
Source File: ErrorDisplay.cs
private void copyDetailMenuItem_Click(object sender, System.EventArgs e)
		{
			if ( detailList.SelectedItem != null )
				Clipboard.SetDataObject( detailList.SelectedItem.ToString() );
		}

17. Example

Project: ContinuousTests
Source File: ErrorDisplay.cs
private void copyDetailMenuItem_Click(object sender, System.EventArgs e)
		{
			if ( detailList.SelectedItem != null )
				Clipboard.SetDataObject( detailList.SelectedItem.ToString() );
		}

18. Example

Project: ContinuousTests
Source File: ErrorDisplay.cs
private void copyDetailMenuItem_Click(object sender, System.EventArgs e)
		{
			if ( detailList.SelectedItem != null )
				Clipboard.SetDataObject( detailList.SelectedItem.ToString() );
		}

19. Example

Project: naps2
Source File: FProfiles.cs
private void ctxCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(GetSelectedProfileDataObject());
        }

20. Example

Project: EDDiscovery
Source File: UserControlExpedition.cs
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataObject obj = dataGridViewRouteSystems.GetClipboardContent();

            try
            {
                Clipboard.SetDataObject(obj);
            }
            catch
            {
                System.Diagnostics.Trace.WriteLine("Unable to access clipboard");
            }
        }

21. Example

Project: EDDiscovery
Source File: UserControlExploration.cs
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataObject obj = dataGridViewExplore.GetClipboardContent();

            try
            {
                Clipboard.SetDataObject(obj);
            }
            catch
            {
                System.Diagnostics.Trace.WriteLine("Unable to access clipboard");
            }
        }

22. Example

Project: MapViewer
Source File: ObjectListView.cs
public virtual void CopyObjectsToClipboard(IList objectsToCopy) {
            if (objectsToCopy.Count == 0)
                return;

            // We don't know where these objects came from, so we can't use the DragSource to create
            // the data object, like we do with CopySelectionToClipboard() above.
            OLVDataObject dataObject = new OLVDataObject(this, objectsToCopy);
            dataObject.CreateTextFormats();
            Clipboard.SetDataObject(dataObject);
        }

23. Example

Project: KeeThief
Source File: ClipboardContents.cs
private void SetDataPriv()
		{
			if(m_strText != null)
				ClipboardUtil.Copy(m_strText, false, false, null, null, IntPtr.Zero);
			else if(m_vContents != null)
			{
				DataObject dObj = new DataObject();
				foreach(KeyValuePair<string, object> kvp in m_vContents)
					dObj.SetData(kvp.Key, kvp.Value);

				ClipboardUtil.Clear();
				Clipboard.SetDataObject(dObj);
			}
		}

24. Example

Project: RevitLookup
Source File: Utils.cs
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();
         }

      }

25. Example

Project: PokemonSunMoonRNGTool
Source File: Form1.cs
private void mnuCopy_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = (ToolStripMenuItem)sender;
            ContextMenuStrip cms = (ContextMenuStrip)tsmi.Owner;
            DataGridView dgv = (DataGridView)cms.SourceControl;

            try
            {
                Clipboard.SetDataObject(dgv.GetClipboardContent());
            }
            catch (ArgumentNullException)
            {
                Error(msgstr[18]);
            }
        }

26. Example

Project: Gorgon
Source File: FormMain.cs
private void itemCut_Click(object sender, EventArgs e)
		{
			try
			{
				if ((treeFiles.SelectedNode == null) || (treeFiles.SelectedNode == _rootNode))
				{
					return;
				}

				treeFiles.SelectedNode.Redraw();

				var cutCopyObject = new CutCopyObject(treeFiles.SelectedNode.FullPath,
				                                      ((sender == itemCut) || (sender == popupItemCut)));

				Clipboard.SetDataObject(cutCopyObject);
				_clipboardData = true;
			}
			finally
			{
				ValidateControls();
			}
		}

27. Example

Project: JiHuangBaiKeCSharp
Source File: DedicatedServerPage.xaml.cs
private void Bx_Click(object sender, RoutedEventArgs e)
        {
            var code = ((Button)sender).Tag.ToString();
            // ???????,?????code
            if (DediConsoleFenLei.Tag.ToString() == "??")
            {
                SsendMessage(code);
                System.Windows.Forms.Clipboard.SetDataObject(code);
            }
            // ??????
            else
            {
                SsendMessage("c_give(\"" + code + "\", 1)");
                System.Windows.Forms.Clipboard.SetDataObject("c_give(\"" + code + "\", 1)");
            }





        }

28. Example

Project: AutoTest.Net
Source File: ErrorDisplay.cs
private void copyDetailMenuItem_Click(object sender, System.EventArgs e)
		{
			if ( detailList.SelectedItem != null )
				Clipboard.SetDataObject( detailList.SelectedItem.ToString() );
		}

29. Example

Project: AutoTest.Net
Source File: ErrorDisplay.cs
private void copyDetailMenuItem_Click(object sender, System.EventArgs e)
		{
			if ( detailList.SelectedItem != null )
				Clipboard.SetDataObject( detailList.SelectedItem.ToString() );
		}

30. Example

Project: AutoTest.Net
Source File: ErrorDisplay.cs
private void copyDetailMenuItem_Click(object sender, System.EventArgs e)
		{
			if ( detailList.SelectedItem != null )
				Clipboard.SetDataObject( detailList.SelectedItem.ToString() );
		}

31. Example

Project: naps2
Source File: FDesktop.cs
private void CopyImages()
        {
            if (SelectedIndices.Any())
            {
                var ido = GetDataObjectForImages(SelectedImages, true);
                Clipboard.SetDataObject(ido);
            }
        }

32. Example

Project: diagramnet
Source File: Designer.cs
public void Copy()
		{
			if (document.SelectedElements.Count == 0) return;

			IFormatter formatter = new BinaryFormatter();
			Stream stream = new MemoryStream();
			formatter.Serialize(stream, document.SelectedElements.GetArray());
			DataObject data = new DataObject(DataFormats.GetFormat("Diagram.NET Element Collection").Name,
				stream);
			Clipboard.SetDataObject(data);
		}

33. Example

Project: gitextensions
Source File: HtmlFragment.cs
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
        }

34. Example

Project: clrprofiler
Source File: CallTreeForm.cs
private void menuItem9_Click(object sender, System.EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            bool fFirstHeader = true;

            foreach (System.Windows.Forms.ColumnHeader h in stackView.Columns)
            {
                if (!fFirstHeader)
                    sb.Append("\t");

                fFirstHeader = false;
                
                sb.Append(h.Text);
            }

            sb.Append("\r\n");
            
            foreach (ListViewItem itm in stackView.Items)
            {
                bool fFirst = true;

                foreach (ListViewItem.ListViewSubItem sitm in itm.SubItems)
                {
                    if (!fFirst)
                        sb.Append("\t");

                    fFirst = false;
                    
                    sb.Append(sitm.Text);
                }
                sb.Append("\r\n");
            }         
            
            Clipboard.SetDataObject(sb.ToString());
        }

35. Example

Project: OrionSDK
Source File: QueryTab.cs
private void CopyActiveGridCellToClipboard(DataGridView visibleDataGridView)
        {
            if (visibleDataGridView.GetCellCount(DataGridViewElementStates.Selected) > 0)
            {
                Clipboard.SetDataObject(visibleDataGridView.GetClipboardContent());
            }
        }

36. Example

Project: nquery
Source File: QueryDocument.cs
private static void CopyErrorMessagesToClipboard(ListView errorListView)
		{
			StringBuilder sb = new StringBuilder();
			foreach (ListViewItem item in errorListView.Items)
			{
				if (item.Selected)
				{
					sb.Append(item.Text);
					sb.Append(Environment.NewLine);
				}
			}

			Clipboard.SetDataObject(sb.ToString());
		}

37. Example

Project: duality
Source File: ProjectFolderView.cs
protected void ClipboardCopyNodes(IEnumerable<TreeNodeAdv> nodes)
		{
			DataObject data = new DataObject();
			this.AppendNodesToData(data, nodes);

			Clipboard.Clear();
			Clipboard.SetDataObject(data);
		}

38. Example

Project: tesvsnip
Source File: virtuallistview.cs
public void Copy()
        {
            SelectedIndexCollection indices = SelectedIndices;
            int nItems = indices.Count;
            int nCols = Columns.Count;
            var illegal = new[] {'\t', '\n'};
            var items = new string[nItems + 1];
            var colvals = new string[nCols];
            for (int j = 0; j < nCols; j++)
            {
                ColumnHeader header = Columns[j];
                colvals[header.Index] = header.Text;
            }
            items[0] = string.Join("\t", colvals);
            for (int i = 0; i < nItems; i++)
            {
                int idx = indices[i];
                for (int j = 0; j < nCols; j++)
                {
                    int col = Columns[j].Index;
                    string text = GetItemText(idx, col);
                    if (-1 != text.IndexOfAny(illegal))
                        text = '\"' + text + '\"';
                    colvals[col] = text;
                }
                items[i + 1] = string.Join("\t", colvals);
            }
            Clipboard.SetDataObject(string.Join("\r\n", items));
        }

39. Example

Project: falloutsnip
Source File: virtuallistview.cs
public void Copy()
        {
            SelectedIndexCollection indices = SelectedIndices;
            int nItems = indices.Count;
            int nCols = Columns.Count;
            var illegal = new[] {'\t', '\n'};
            var items = new string[nItems + 1];
            var colvals = new string[nCols];
            for (int j = 0; j < nCols; j++)
            {
                ColumnHeader header = Columns[j];
                colvals[header.Index] = header.Text;
            }
            items[0] = string.Join("\t", colvals);
            for (int i = 0; i < nItems; i++)
            {
                int idx = indices[i];
                for (int j = 0; j < nCols; j++)
                {
                    int col = Columns[j].Index;
                    string text = GetItemText(idx, col);
                    if (-1 != text.IndexOfAny(illegal))
                        text = '\"' + text + '\"';
                    colvals[col] = text;
                }
                items[i + 1] = string.Join("\t", colvals);
            }
            Clipboard.SetDataObject(string.Join("\r\n", items));
        }

40. Example

Project: fomm
Source File: dxmutgui.cs
protected void CopyToClipboard()
        {
            // Copy the selection text to the clipboard
            if (caretPosition != textData.SelectionStart)
            {
                int first = Math.Min(caretPosition, textData.SelectionStart);
                int last = Math.Max(caretPosition, textData.SelectionStart);
                // Set the text to the clipboard
                System.Windows.Forms.Clipboard.SetDataObject(textData.Text.Substring(first, (last-first)));
            }

        }

41. Example

Project: clrprofiler
Source File: SummaryForm.cs
private void copyMenuItem_Click(object sender, System.EventArgs e)
        {
            Label[] cop/n ..... /n //View Source file for more details /n }

42. Example

Project: openHistorian
Source File: FrmConfigure.cs
private void dgvTerminals_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.C)
            {
                DataObject d = dgvTerminals.GetClipboardContent();
                Clipboard.SetDataObject(d);
                e.Handled = true;
            }
            else if (e.Control && e.KeyCode == Keys.V)
            {
                //int row = dgvTerminals.CurrentCell.RowIndex;
                //int col = dgvTerminals.CurrentCell.ColumnIndex;
                string s = Clipboard.GetText();
                foreach (string line in s.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                {
                    string[] cells = line.Split('\t');
                    m_settings.MyData.Tables["Terminals"].Rows.Add(cells);
                 
                    //if (dgvTerminals.Rows.Count >= row)
                    //    dgvTerminals.Rows.Add(cells);
                    //else
                    //{
                    //    int cellsSelected = cells.Length;
                    //    for (int i = 0; i < cellsSelected; i++)
                    //    {
                    //        dgvTerminals[col + i, row].Value = cells[i];
                    //    }
                    //    row++;
                    //}

                }

            }
        }

43. Example

Project: ME3Explorer
Source File: PlotVarDB.cs
private void plotVarTable_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete && e.Modifiers == Keys.Shift)
            {
                deleteCurrentRow();
            }
            else if (e.KeyCode == Keys.Delete)
            {
                deleteCurrentCell();
            } else if (e.Control && e.KeyCode == Keys.C)
            {
                DataObject d = plotVarTable.GetClipboardContent();
                Clipboard.SetDataObject(d);
                e.Handled = true;
            }
            else if (e.Control && e.KeyCode == Keys.V)
            {
                string s = Clipboard.GetText();
                string[] lines = s.Split('\n');
                int row = plotVarTable.CurrentCell.RowIndex;
                int col = plotVarTable.CurrentCell.ColumnIndex;
                string[] cells = lines[0].Split('\t');
                int cellsSelected = cells.Length;
                for (int i = 0; i < cellsSelected; i++)
                {
                    plotVarTable[col, row].Value = cells[i];
                    col++;
                }
            }
        }

44. Example

Project: NetOffice
Source File: Test08.cs
public TestResult DoTest()
        {
            Excel.Application application = null;
            D/n ..... /n //View Source file for more details /n }

45. Example

Project: NetOffice
Source File: Test07.cs
public TestResult DoTest()
        {
            Outlook.Application application = null;
           /n ..... /n //View Source file for more details /n }

46. Example

Project: NetOffice
Source File: Test06.cs
public TestResult DoTest()
        {
            PowerPoint.Application application = null;
        /n ..... /n //View Source file for more details /n }

47. Example

Project: l2net
Source File: RichTextBoxEx.cs
public void InsertBMP(System.Drawing.Bitmap bmp)
        {

            var OriData = Clipboard.GetDataObject();

            // Copy the bitmap to the clipboard.
            Clipboard.SetDataObject(bmp);

            // Get the format for the object type.
            DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap);

            if (this.CanPaste(myFormat))
            {

                this.Paste(myFormat);
            }

            Clipboard.SetDataObject(OriData);

        }

48. Example

Project: NetOffice
Source File: Test07.cs
public TestResult DoTest()
        {
            Word.Application application = null;
            Da/n ..... /n //View Source file for more details /n }

49. Example

Project: GestureSign
Source File: ClipboardMatch.cs
public bool Gestured(PointInfo actionPoint)
        {
            bool success = false;
            actionPoint.SyncContext.Send(state =>
            {
                IDataObject iData = Clipboard.GetDataObject();
                if (iData != null && iData.GetDataPresent(DataFormats.Text))
                {
                    string source = (string)iData.GetData(DataFormats.Text);
                    Regex reg = new Regex(_matchString);
                    var match = reg.Match(source);
                    if (match.Success)
                    {
                        string result = match.Value;
                        if (!string.IsNullOrWhiteSpace(result))
                        {
                            Clipboard.SetDataObject(result);
                            success = true;
                        }
                    }
                }
            }, null);

            return success;
        }

50. Example

Project: duality
Source File: ObjectRefPropertyEditor.cs
protected override void OnKeyDown(KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.ShowReferencedContent();
				e.Handled = true;
			}
			else if (e.KeyCode == Keys.C && e.Control)
			{
				DataObject data = new DataObject();
				this.SerializeToData(data);
				Clipboard.SetDataObject(data);
				e.Handled = true;
			}
			else if (e.KeyCode == Keys.V && e.Control)
			{
				DataObject data = Clipboard.GetDataObject() as DataObject;
				this.DeserializeFromData(data);

				e.Handled = true;
			}
			base.OnKeyDown(e);
		}