Here are the examples of the csharp api class System.Windows.Forms.Clipboard.ContainsData(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
16 Examples
0
1. Example
View licensepublic static void ClipWait(double timeout, bool type) { int frequency = 100, time = (int)(timeout * 1000); for (int i = 0; i < time; i += frequency) { if ((!type && Clipboard.ContainsText()) || Clipboard.ContainsData(DataFormats.WaveAudio)) { ErrorLevel = 0; return; } System.Threading.Thread.Sleep(frequency); } ErrorLevel = 1; }
0
2. Example
View licenseprivate string GetActiveWindowsTextSelection() { // Obtain the handle of the active window. //IntPtr handle = GetForegroundWindow(); //SendCtrlC(handle); if (Clipboard.ContainsData(DataFormats.Html)) { var html = (string) Clipboard.GetData(DataFormats.Html); var output = ClipboardHtmlHelper.ParseString(html); if (!string.IsNullOrWhiteSpace(output.Source)) { return string.Format("<a href=\"{0}\">{0}</a><br /><br />{1}", output.Source, output.Html); } return output.Html; } return Clipboard.GetText(); }
0
3. Example
View licenseprivate void PasteClipboard() { try { if (Clipboard.ContainsData("ws.model.columncollection")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.columncollection")); foreach (XmlNode node in document.DocumentElement.SelectNodes("column")) { this.PasteColumn(node); } this.OnItemChanged(this, new System.EventArgs()); } else if (Clipboard.ContainsData("ws.model.column")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.column")); this.PasteColumn(document.DocumentElement); this.OnItemChanged(this, new System.EventArgs()); } } catch (Exception ex) { throw; } }
0
4. Example
View licenseprivate void PasteMenuClick(object sender, System.EventArgs e) { try { if (Clipboard.ContainsData("ws.model.storedprocedurecolumn")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.storedprocedurecolumn")); var newItem = ((CustomStoredProcedureColumnCollection)this.Object).Add(); var id = newItem.Id; newItem.XmlLoad(document.DocumentElement); newItem.SetId(id); newItem.SetKey(Guid.NewGuid().ToString()); newItem.Name = "[" + newItem.Name + "]"; this.OnItemChanged(this, new System.EventArgs()); } } catch (Exception ex) { throw; } }
0
5. Example
View license[Command(null, "Paste")] public bool Paste(bool run = true) { if (Clipboard.ContainsData("DiagramDocument")) { if (run) { var buf = Clipboard.GetData("DiagramDocument") as byte[]; if (buf != null) PasteAndSelect(new MemoryStream(buf), VectorT.Zero); } return true; } else if (Clipboard.ContainsText()) { if (run) { var text = Clipboard.GetText(); DoOrUndo act = null; if (_focusShape != null && (act = _focusShape.AppendTextAction(text)) != null) _doc.UndoStack.Do(act, true); else { var textBox = new TextBox(new BoundingBox<Coord>(0, 0, 300, 200)) { Text = text, TextJustify = LLTextShape.JustifyMiddleCenter, BoxType = BoxType.Borderless, Style = BoxStyle }; _doc.AddShape(textBox); } } return true; } return false; }
0
6. Example
View licensepublic static bool ContainsData(string strFormat) { if(!NativeLib.IsUnix()) return Clipboard.ContainsData(strFormat); if(string.IsNullOrEmpty(strFormat)) { Debug.Assert(false); return false; } if((strFormat == DataFormats.CommaSeparatedValue) || (strFormat == DataFormats.Html) || (strFormat == DataFormats.OemText) || (strFormat == DataFormats.Rtf) || (strFormat == DataFormats.Text) || (strFormat == DataFormats.UnicodeText)) return ContainsText(); string strData = GetText(); return StrUtil.IsDataUri(strData, ClipFmtToMimeType(strFormat)); }
0
7. Example
View licenseprivate void PasteMenuClick(object sender, System.EventArgs e) { try { if (Clipboard.Con/n ..... /n //View Source file for more details /n }
0
8. Example
View licenseprivate void PasteClipboard() { try { var customStoredProcedureCollection = (CustomStoredProcedureCollection)this.Object; if (Clipboard.ContainsData("ws.model.storedprocedurecollection")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.storedprocedurecollection")); foreach (XmlNode node in document.DocumentElement.SelectNodes("z")) { var tableNode = node.SelectSingleNode("storedprocedure"); var columnListNode = node.SelectSingleNode("columnList"); var parameterListNode = node.SelectSingleNode("parameterList"); this.PasteTable(customStoredProcedureCollection, tableNode, columnListNode, parameterListNode); } this.OnItemChanged(this, new System.EventArgs()); } else if (Clipboard.ContainsData("ws.model.storedprocedure")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.storedprocedure")); this.PasteTable(customStoredProcedureCollection, document.DocumentElement.SelectSingleNode("storedprocedure"), document.DocumentElement.SelectSingleNode("columnList"), document.DocumentElement.SelectSingleNode("parameterList")); this.OnItemChanged(this, new System.EventArgs()); } } catch (Exception ex) { throw; } }
0
9. Example
View licenseprivate void PasteClipboard() { try { var customViewCollection = (CustomViewCollection)this.Object; if (Clipboard.ContainsData("ws.model.viewcollection")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.viewcollection")); foreach (XmlNode node in document.DocumentElement.SelectNodes("z")) { var viewNode = node.SelectSingleNode("view"); var columnListNode = node.SelectSingleNode("columnList"); this.PasteTable(customViewCollection, viewNode, columnListNode); } this.OnItemChanged(this, new System.EventArgs()); } else if (Clipboard.ContainsData("ws.model.view")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.view")); this.PasteTable(customViewCollection, document.DocumentElement.SelectSingleNode("view"), document.DocumentElement.SelectSingleNode("columnList")); this.OnItemChanged(this, new System.EventArgs()); } } catch (Exception ex) { throw; } }
0
10. Example
View licenseprivate void PasteClipboard() { try { var tableCollection = (TableCollection)this.Object; if (Clipboard.ContainsData("ws.model.tablecollection")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.tablecollection")); foreach (XmlNode node in document.DocumentElement.SelectNodes("z")) { var tableNode = node.SelectSingleNode("table"); var columnListNode = node.SelectSingleNode("columnList"); this.PasteTable(tableCollection, tableNode, columnListNode); } this.OnItemChanged(this, new System.EventArgs()); } else if (Clipboard.ContainsData("ws.model.table")) { var document = new XmlDocument(); document.LoadXml((string)Clipboard.GetData("ws.model.table")); this.PasteTable(tableCollection, document.DocumentElement.SelectSingleNode("table"), document.DocumentElement.SelectSingleNode("columnList")); this.OnItemChanged(this, new System.EventArgs()); } } catch (Exception ex) { throw; } }
0
11. Example
View licensepublic static Bitmap GetImage() { Bitmap result; // http://csharphelper.com/blog/2014/09/paste-a-png-format-image-with-a-transparent-background-from-the-clipboard-in-c/ result = null; try { if (Clipboard.ContainsData(PngFormat)) { object data; data = Clipboard.GetData(PngFormat); if (data != null) { Stream stream; stream = data as MemoryStream; if (stream == null) { byte[] buffer; buffer = data as byte[]; if (buffer != null) { stream = new MemoryStream(buffer); } } if (stream != null) { result = Image.FromStream(stream).Copy(); stream.Dispose(); } } } if (result == null) { result = (Bitmap)Clipboard.GetImage(); } } catch (Exception ex) { MessageBox.Show(string.Format("Failed to obtain image. {0}", ex.GetBaseException().Message), "Paste Image", MessageBoxButtons.OK, MessageBoxIcon.Error); } return result; }
0
12. Example
View licensepublic void CellPaste() { DataGridViewCell cell = dataGridView.CurrentCell; /n ..... /n //View Source file for more details /n }
0
13. Example
View licenseprivate void parentBoard_ShortcutKeyPressed(Board selectedBoard, bool ctrl, bool shift, bool alt, Ke/n ..... /n //View Source file for more details /n }
0
14. Example
View licensepublic void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.ControlKey) this.EmitInvalidate(); if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Right || (e.KeyCode == Keys.Down && e.Control)) { this.ShowDropDown(); e.Handled = true; } else if (e.Control && e.KeyCode == Keys.C) { DataObject data = new DataObject(); data.SetText(this.bitmaskStr); data.SetData(ClipboardDataFormat, this.bitmask); Clipboard.SetDataObject(data); e.Handled = true; } else if (e.Control && e.KeyCode == Keys.V) { bool success = false; ulong pasteValue = 0; if (Clipboard.ContainsData(ClipboardDataFormat)) { pasteValue = (ulong)Clipboard.GetData(ClipboardDataFormat); success = true; } else if (Clipboard.ContainsText()) { string[] pasteObj = Clipboard.GetText().Split(new [] { ", " }, StringSplitOptions.RemoveEmptyEntries); foreach (string p in pasteObj) { if (p == null) continue; BitmaskItem item = this.dropdownItems.FirstOrDefault(obj => obj != null && p == obj.ToString()); if (item != null) { pasteValue |= item.Value; success = true; } } } if (success) { this.bitmask = pasteValue; this.bitmaskStr = this.DefaultValueStringGenerator(this.bitmask); this.EmitInvalidate(); this.EmitEdited(this.bitmask); } else System.Media.SystemSounds.Beep.Play(); e.Handled = true; } }
0
15. Example
View licensepublic void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.ControlKey) this.EmitInvalida/n ..... /n //View Source file for more details /n }
0
16. Example
View licensepublic void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.ControlKey) this.EmitInvalida/n ..... /n //View Source file for more details /n }