Here are the examples of the csharp api class System.Windows.Forms.Clipboard.GetDataObject() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
135 Examples
0
1. Example
Project: ConfigurationSectionDesigner
Source File: ConfigurationSectionDesignerClipboardCommandSet.cs
View licenseSource File: ConfigurationSectionDesignerClipboardCommandSet.cs
protected override void ProcessOnStatusPasteCommand(System.ComponentModel.Design.MenuCommand cmd) { base.ProcessOnStatusPasteCommand(cmd); if (!cmd.Enabled && this.SingleSelection is ElementListCompartment) { var compartment = (ElementListCompartment)this.SingleSelection; ShapeElement pasteTarget = compartment.ParentShape; System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); if (pasteTarget != null && this.ElementOperations.CanMerge(pasteTarget, data)) { cmd.Enabled = true; } } }
0
2. Example
Project: ConfigurationSectionDesigner
Source File: ConfigurationSectionDesignerClipboardCommandSet.cs
View licenseSource File: ConfigurationSectionDesignerClipboardCommandSet.cs
protected override void ProcessOnMenuPasteCommand() { if (this.SingleSelection is ElementListCompartment) { var compartment = (ElementListCompartment)this.SingleSelection; ShapeElement pasteTarget = compartment.ParentShape; System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); if (pasteTarget != null && this.ElementOperations.CanMerge(pasteTarget, data)) { using (Transaction t = pasteTarget.Store.TransactionManager.BeginTransaction("paste")) { this.ElementOperations.Merge(pasteTarget, data); t.Commit(); } } } else { base.ProcessOnMenuPasteCommand(); } }
0
3. Example
Project: ConfigurationSectionDesigner
Source File: ConfigurationSectionDesignerClipboardCommandSet.cs
View licenseSource File: ConfigurationSectionDesignerClipboardCommandSet.cs
protected override void ProcessOnStatusPasteCommand(System.ComponentModel.Design.MenuCommand cmd) { base.ProcessOnStatusPasteCommand(cmd); if (!cmd.Enabled && this.SingleSelection is ElementListCompartment) { var compartment = (ElementListCompartment)this.SingleSelection; ShapeElement pasteTarget = compartment.ParentShape; System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); if (pasteTarget != null && this.ElementOperations.CanMerge(pasteTarget, data)) { cmd.Enabled = true; } } }
0
4. Example
Project: ConfigurationSectionDesigner
Source File: ConfigurationSectionDesignerClipboardCommandSet.cs
View licenseSource File: ConfigurationSectionDesignerClipboardCommandSet.cs
protected override void ProcessOnMenuPasteCommand() { if (this.SingleSelection is ElementListCompartment) { var compartment = (ElementListCompartment)this.SingleSelection; ShapeElement pasteTarget = compartment.ParentShape; System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); if (pasteTarget != null && this.ElementOperations.CanMerge(pasteTarget, data)) { using (Transaction t = pasteTarget.Store.TransactionManager.BeginTransaction("paste")) { this.ElementOperations.Merge(pasteTarget, data); t.Commit(); } } } else { base.ProcessOnMenuPasteCommand(); } }
0
5. Example
Project: ConfigurationSectionDesigner
Source File: ConfigurationSectionDesignerClipboardCommandSet.cs
View licenseSource File: ConfigurationSectionDesignerClipboardCommandSet.cs
protected override void ProcessOnStatusPasteCommand(System.ComponentModel.Design.MenuCommand cmd) { base.ProcessOnStatusPasteCommand(cmd); if (!cmd.Enabled && this.SingleSelection is ElementListCompartment) { var compartment = (ElementListCompartment)this.SingleSelection; ShapeElement pasteTarget = compartment.ParentShape; System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); if (pasteTarget != null && this.ElementOperations.CanMerge(pasteTarget, data)) { cmd.Enabled = true; } } }
0
6. Example
Project: ConfigurationSectionDesigner
Source File: ConfigurationSectionDesignerClipboardCommandSet.cs
View licenseSource File: ConfigurationSectionDesignerClipboardCommandSet.cs
protected override void ProcessOnMenuPasteCommand() { if (this.SingleSelection is ElementListCompartment) { var compartment = (ElementListCompartment)this.SingleSelection; ShapeElement pasteTarget = compartment.ParentShape; System.Windows.Forms.IDataObject data = System.Windows.Forms.Clipboard.GetDataObject(); if (pasteTarget != null && this.ElementOperations.CanMerge(pasteTarget, data)) { using (Transaction t = pasteTarget.Store.TransactionManager.BeginTransaction("paste")) { this.ElementOperations.Merge(pasteTarget, data); t.Commit(); } } } else { base.ProcessOnMenuPasteCommand(); } }
0
7. Example
View licensepublic static IDataObject GetDataObject() { // retry 2 times should be enough for read access try { return Clipboard.GetDataObject(); } catch (ExternalException) { try { return Clipboard.GetDataObject(); } catch (ExternalException) { return new DataObject(); } } }
0
8. Example
View licenseprivate void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) { var ido = Clipboard.GetDataObject(); var canPaste = ido != null && ido.GetDataPresent(typeof (DirectProfileTransfer).FullName); if (SelectedProfile == null) { if (canPaste) { foreach (ToolStripItem item in contextMenuStrip.Items) { if (item != ctxPaste) { item.Visible = false; } } ctxPaste.Enabled = true; } else { e.Cancel = true; } } else { foreach (ToolStripItem item in contextMenuStrip.Items) { item.Visible = true; } ctxSetDefault.Enabled = !SelectedProfile.IsDefault; ctxEdit.Enabled = true; ctxDelete.Enabled = !SelectedProfile.IsLocked; ctxCopy.Enabled = true; ctxPaste.Enabled = canPaste; } }
0
9. Example
View licenseinternal static T GetClipboardData<T>() where T : class { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); if (od != null) { var clip = od.GetData(typeof (T).FullName); return clip as T; } return default(T); } return s_clipboard as T; }
0
10. Example
View licenseinternal static bool HasClipboardData() { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); return od != null && od.GetDataPresent("TESVSnip"); } return Clipboard != null; }
0
11. Example
View licenseinternal static bool HasClipboardData<T>() { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); return od != null && od.GetDataPresent(typeof (T).FullName); } return Clipboard is T; }
0
12. Example
View licenseinternal static T GetClipboardData<T>() where T : class { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); if (od != null) { var clip = od.GetData(typeof(T).FullName); return clip as T; } return default(T); } return s_clipboard as T; }
0
13. Example
View licenseinternal static bool HasClipboardData() { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); return od != null && od.GetDataPresent("FalloutSnip"); } return Clipboard != null; }
0
14. Example
View licenseinternal static bool HasClipboardData<T>() { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); return od != null && od.GetDataPresent(typeof(T).FullName); } return Clipboard is T; }
0
15. Example
View licenseprivate void menuEdit_Popup(object sender, EventArgs ea) { MDIChild mc = this.Ac/n ..... /n //View Source file for more details /n }
0
16. Example
View licenseprivate void _imageUrl_Paste(object sender, TextBoxWithPaste.PasteEventArgs eventArgs) { //special case...image on clipboard if (_webImageUrl.Text.Trim() == String.Empty) { DataObjectMeister dataObject = new DataObjectMeister(Clipboard.GetDataObject()); if (dataObject.HTMLData != null && dataObject.HTMLData.OnlyImagePath != null) { _webImageUrl.Text = dataObject.HTMLData.OnlyImagePath; } } PopulatePreviewBox(); _webImageUrl.SelectAll(); }
0
17. Example
View licensepublic static bool EditFieldAcceptsData() { IDataObject clipboard = Clipboard.GetDataObject(); string[] formats = clipboard.GetFormats(); foreach (string format in formats) { switch (format) { case "HTML Format": case "System.String": case "Text": case "UnicodeText": return true; } } return false; }
0
18. Example
View licensepublic static bool IsClipboardEmpty() { IDataObject clipboardData = Clipboard.GetDataObject(); return clipboardData == null || clipboardData.GetFormats().Length == 0; }
0
19. Example
View licenseprivate void pasteToolStripButton_Click(object sender, EventArgs e) { // Source: http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.copy(v=vs.110).aspx if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true) { if (lastSelectedTextControl.SelectionLength > 0) lastSelectedTextControl.SelectionStart = lastSelectedTextControl.SelectionStart + lastSelectedTextControl.SelectionLength; lastSelectedTextControl.Paste(); } }
0
20. Example
View licenseprotected bool ClipboardCanPasteNodes(TreeNodeAdv baseNode) { DataObject data = Clipboard.GetDataObject() as DataObject; return data != null && data.ContainsFileDropList(); }
0
21. Example
View licensepublic static string GetClipboardText() { IDataObject ido = Clipboard.GetDataObject(); if (ido.GetDataPresent(DataFormats.UnicodeText) == false) return ""; return (string)ido.GetData(DataFormats.UnicodeText); }
0
22. Example
View licensepublic bool CanPaste() { if (ReadOnly || !this.Enabled) return false; if(_byteProvider == null || !_byteProvider.SupportsInsertBytes()) return false; if(!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) return false; IDataObject da = Clipboard.GetDataObject(); if(da.GetDataPresent("BinaryData")) return true; else if(da.GetDataPresent(typeof(string))) return true; else return false; }
0
23. Example
View licenseinternal static object GetClipboardData() { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); if (od != null) { var cliptype = od.GetData("TESVSnip"); if (cliptype is string) { return od.GetData(cliptype.ToString()); } } return null; } return s_clipboard; }
0
24. Example
View licensepublic bool CanPaste() { if (ReadOnly || !Enabled) return false; if (_byteProvider == null || !_byteProvider.SupportsInsertBytes()) return false; if (!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) return false; IDataObject da = Clipboard.GetDataObject(); if (da.GetDataPresent("BinaryData")) return true; else if (da.GetDataPresent(typeof (string))) return true; else return false; }
0
25. Example
View licenseinternal static object GetClipboardData() { if (Settings.Default.UseWindowsClipboard) { var od = System.Windows.Forms.Clipboard.GetDataObject(); if (od != null) { var cliptype = od.GetData("FalloutSnip"); if (cliptype is string) { return od.GetData(cliptype.ToString()); } } return null; } return s_clipboard; }
0
26. Example
View licensepublic bool CanPaste() { if (ReadOnly || !Enabled) return false; if (_byteProvider == null || !_byteProvider.SupportsInsertBytes()) return false; if (!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) return false; IDataObject da = Clipboard.GetDataObject(); if (da.GetDataPresent("BinaryData")) return true; else if (da.GetDataPresent(typeof (string))) return true; else return false; }
0
27. Example
View licensepublic bool CanPaste() { if (ReadOnly || !Enabled) { return false; } if (_byteProvider == null || !_byteProvider.SupportsInsertBytes()) { return false; } if (!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) { return false; } var da = Clipboard.GetDataObject(); if (da.GetDataPresent("BinaryData")) { return true; } if (da.GetDataPresent(typeof (string))) { return true; } return false; }
0
28. Example
View licensepublic bool FilterMessage(ref Message m) { if (!enabled) { /n ..... /n //View Source file for more details /n }
0
29. Example
View licensepublic bool CanPaste() { if (ReadOnly || !this.Enabled) return false; if(_byteProvider == null || !_byteProvider.SupportsInsertBytes()) return false; if(!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) return false; IDataObject da = Clipboard.GetDataObject(); if(da.GetDataPresent("BinaryData")) return true; else if(da.GetDataPresent(typeof(string))) return true; else return false; }
0
30. Example
View licensepublic void Paste(object sender, EventArgs e) { if (!textArea.EnableCutOrPaste) { return; } // Clipboard.GetDataObject may throw an exception... for (int i = 0;; i++) { try { IDataObject data = Clipboard.GetDataObject(); if (data == null) return; bool fullLine = data.GetDataPresent(LineSelectedType); if (data.GetDataPresent(DataFormats.UnicodeText)) { string text = (string)data.GetData(DataFormats.UnicodeText); if (text.Length > 0) { textArea.Document.UndoStack.StartUndoGroup(); try { if (textArea.SelectionManager.HasSomethingSelected) { textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition; textArea.SelectionManager.RemoveSelectedText(); } if (fullLine) { int col = textArea.Caret.Column; textArea.Caret.Column = 0; if (!textArea.IsReadOnly(textArea.Caret.Offset)) textArea.InsertString(text); textArea.Caret.Column = col; } else { // textArea.EnableCutOrPaste already checked readonly for this case textArea.InsertString(text); } } finally { textArea.Document.UndoStack.EndUndoGroup(); } } } return; } catch (ExternalException) { // GetDataObject does not provide RetryTimes parameter if (i > 5) throw; } } }
0
31. Example
View licenseprivate void buttonPasteeLink_Click(object sender, System.EventArgs e) { string elink=""; IDataObject iData = Clipboard.GetDataObject(); if(iData.GetDataPresent(DataFormats.Text)) { elink=(String)iData.GetData(DataFormats.Text); if (elink!="") krnGateway.DownloadElink(elink,false); } }
0
32. Example
View licensepublic static T GetFromClipboard() { T retrievedObj = null; var dataObj = Clipboard.GetDataObject(); var format = typeof(T).FullName; if (dataObj.GetDataPresent(format)) { retrievedObj = dataObj.GetData(format) as T; } return retrievedObj; }
0
33. Example
View licensepublic static T GetFromClipboard() { T retrievedObj = null; IDataObject dataObj = Clipboard.GetDataObject(); string format = typeof(T).FullName; if (dataObj.GetDataPresent(format)) { retrievedObj = dataObj.GetData(format) as T; } return retrievedObj; }
0
34. Example
View licenseprivate void menuContext_Popup(object sender, EventArgs e) { var bEnable = _DrawPanel.SelectedCount > 0; MenuDefaultCopy.Enabled = bEnable; MenuDefaultDelete.Enabled = bEnable; var al = new List<XmlNode>(); var iData = Clipboard.GetDataObject(); if (iData == null) bEnable = false; else if (iData.GetDataPresent(al.GetType())) bEnable = true; else if (iData.GetDataPresent(DataFormats.Text)) bEnable = true; else if (iData.GetDataPresent(DataFormats.Bitmap)) bEnable = true; else bEnable = false; MenuDefaultPaste.Enabled = bEnable; MenuChartPaste.Enabled = bEnable; MenuGridPaste.Enabled = bEnable; MenuMatrixPaste.Enabled = bEnable; MenuSubreportPaste.Enabled = bEnable; MenuTablePaste.Enabled = bEnable; }
0
35. Example
View licenseprivate void menuEditPaste_Click(object sender, System.EventArgs ea) { if (this.ctlEditTextbox != null && ctlEditTextbox.Focused) { ctlEditTextbox.Paste(); return; } RdlEditPreview e = GetEditor(); if (e == null) return; if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true || Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap) == true) e.Paste(); }
0
36. Example
View licensepublic bool CanPaste() { if (MapDoc == null) return false; IDataObject iData = Clipboard.GetDataObject(); if (iData == null) return false; if (!iData.GetDataPresent(DataFormats.Text)) return false; // Build the xml string in case it is a straight pasting of text string t = (string)iData.GetData(DataFormats.Text); if (!(t.StartsWith("<MapItems>") && t.EndsWith("</MapItems>"))) return false; return true; }
0
37. Example
View licensepublic bool CanPaste() { if (ReadOnly || !this.Enabled) return false; if (_byteProvider == null || !_byteProvider.SupportsInsertBytes()) return false; if (!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) return false; IDataObject da = Clipboard.GetDataObject(); if (da.GetDataPresent("BinaryData")) return true; else if (da.GetDataPresent(typeof(string))) return true; else return false; }
0
38. Example
View licenseprivate void fetchClipboardEntry(bool allowDuplicate) { IDataObject ido = Clipboard.GetDataObject(); ClipboardEntry ce = new ClipboardEntry(ido); byte[] serialized = ce.Serialize(); byte[] reserialized = new ClipboardEntry(ce.Serialize(), "").Serialize(); if (!ArrayEquals(serialized, reserialized)) { MessageBox.Show("Warning: Unserializable clipboard entry detected"); } if (!allowDuplicate && clips.Items.Count > 0 && ArrayEquals(serialized, ((ClipboardEntry)clips.Items[0].Tag).Serialize())) { return; } string key = "image" + (counter++); previewImages.Images.Add(key, ce.PreviewImage); ListViewItem lvi = new ListViewItem(ce.Caption, previewImages.Images.IndexOfKey(key)); lvi.Tag = ce; clips.Items.Insert(0, lvi); }
0
39. Example
View licenseprivate void PasteOverSelection(IHtmlEditorSelection selection) { if (!IsValidCo/n ..... /n //View Source file for more details /n }
0
40. Example
View licensepublic bool CanPaste() { if (ReadOnly || !this.Enabled) return false; if (_byteProvider == null || !_byteProvider.SupportsInsertBytes()) return false; if (!_byteProvider.SupportsDeleteBytes() && _selectionLength > 0) return false; IDataObject da = Clipboard.GetDataObject(); if (da.GetDataPresent("BinaryData")) return true; else if (da.GetDataPresent(typeof(string))) return true; else return false; }
0
41. Example
View licensepublic bool CanExecute(ICommandTarget target) { IPoderosaView view; ITerminalSession session; if (!GetViewAndSession(target, out view, out session)) return false; var clipboardData = Clipboard.GetDataObject(); if (!clipboardData.GetDataPresent("Text")) return false; return true; }
0
42. Example
View licenseprivate string GetClipboardText() { var clipboardData = Clipboard.GetDataObject(); if (clipboardData != null) { if (clipboardData.GetDataPresent(DataFormats.UnicodeText)) { return clipboardData.GetData(DataFormats.UnicodeText) as string; } if (clipboardData.GetDataPresent(DataFormats.Text)) { return clipboardData.GetData(DataFormats.Text) as string; } } return null; }
0
43. Example
View licensepublic bool CanExecute(ICommandTarget target) { IPoderosaView view; ITerminalSession session; if (!GetViewAndSession(target, out view, out session)) return false; var clipboardData = Clipboard.GetDataObject(); if (clipboardData == null || ( !clipboardData.GetDataPresent(DataFormats.UnicodeText) && !clipboardData.GetDataPresent(DataFormats.Text))) { return false; } return true; }
0
44. Example
View licenseprivate static void GetHtmlFromClipboard( out string htmlCode, out byte[] originalBuffer ) { originalBuffer = GetHtmlFromDataObject( Clipboard.GetDataObject() ); htmlCode = Encoding.UTF8.GetString( originalBuffer ); }
0
45. Example
View licensepublic object GetClipboardData(Type format) { bool clipRetry = false; do { try { IDataObject clipdata = Clipboard.GetDataObject(); return (clipdata != null ? clipdata.GetData(format) : null); } 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); return null; }
0
46. Example
View licensepublic void Paste() { if (!_textArea.EnableCutOrPaste) return; // Clipboard/n ..... /n //View Source file for more details /n }
0
47. Example
View licenseprivate void Paste(object sender, EventArgs e) { if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) { if (txt_question_text.SelectionLength > 0) { if (MessageBox.Show("Do you want to paste over current selection?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No) txt_question_text.SelectionStart = txt_question_text.SelectionStart + txt_question_text.SelectionLength; } txt_question_text.Paste(); } }
0
48. Example
View licenseprivate void PasteImages() { var ido = Clipboard.GetDataObject(); if (ido == null) { return; } if (ido.GetDataPresent(typeof(DirectImageTransfer).FullName)) { var data = (DirectImageTransfer)ido.GetData(typeof(DirectImageTransfer).FullName); ImportDirect(data, true); } }
0
49. Example
View licenseprivate void ctxPaste_Click(object sender, EventArgs e) { if (appConfigManager.Config.NoUserProfiles && profileManager.Profiles.Any(x => x.IsLocked)) { return; } var ido = Clipboard.GetDataObject(); if (ido == null) { return; } if (ido.GetDataPresent(typeof(DirectProfileTransfer).FullName)) { var data = (DirectProfileTransfer)ido.GetData(typeof(DirectProfileTransfer).FullName); AddProfile(data.ScanProfile); } }
0
50. Example
View licensepublic Image Capture() { showVideo.SendMessage(this.lwndC, 0x41e, 0, 0); IDataObject obj1 = Clipboard.GetDataObject(); if (obj1.GetDataPresent(typeof(Bitmap))) { return (Image)obj1.GetData(typeof(Bitmap)); } return null; }