Here are the examples of the csharp api class System.Windows.Forms.DataObject.SetText(string, System.Windows.Forms.TextDataFormat) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
18 Examples
0
1. Example
View licensepublic void CreateTextFormats() { IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }
0
2. Example
View licensepublic static void SetClipboard(string text, TextDataFormat format){ if (string.IsNullOrEmpty(text)){ return; } DataObject obj = new DataObject(); obj.SetText(text, format); SetClipboardData(obj); }
0
3. Example
View licenseprivate void OnItemDrag(object sender, ItemDragEventArgs e) { // Only allow dragging of one item at a time, so deselect all other items foreach (ListViewItem lvi in _listView.Items) { if (lvi != e.Item) lvi.Selected = false; } ListViewItem draggedItem = (ListViewItem) e.Item; var galleryItem = (IGalleryItem) draggedItem.Tag; DataObject data = new DataObject(); if (DragOutside) { data.SetData(galleryItem.Item); data.SetText(galleryItem.Item.ToString(), TextDataFormat.UnicodeText); } // allow event listeners to specify additional formats var galleryItemDragEventArgs = new GalleryItemDragEventArgs(galleryItem); OnItemDrag(galleryItemDragEventArgs); foreach (var additionalData in galleryItemDragEventArgs.AdditionalDataFormats) data.SetData(additionalData); // in order for drag reorder to work, we do this last to ensure that the ListViewItem format is always our item if (DragReorder) { data.SetData(draggedItem); } _listView.DoDragDrop(data, DragDropEffects.Move); }
0
4. Example
View licensepublic void CreateTextFormats() { OLVExporter exporter = this.CreateExporter(); // Put both the text and html versions onto the clipboard. // For some reason, SetText() with UnicodeText doesn't set the basic CF_TEXT format, // but using SetData() does. //this.SetText(sbText.ToString(), TextDataFormat.UnicodeText); this.SetData(exporter.ExportTo(OLVExporter.ExportFormat.TabSeparated)); string exportTo = exporter.ExportTo(OLVExporter.ExportFormat.CSV); if (!String.IsNullOrEmpty(exportTo)) this.SetText(exportTo, TextDataFormat.CommaSeparatedValue); this.SetText(ConvertToHtmlFragment(exporter.ExportTo(OLVExporter.ExportFormat.HTML)), TextDataFormat.Html); }
0
5. Example
View licenseprivate void SETextBox_MouseDown(object sender, MouseEventArgs e) { if (MouseButtons == MouseButtons.Left && !string.IsNullOrEmpty(_dragText)) { Point pt = new Point(e.X, e.Y); int index = GetCharIndexFromPosition(pt); if (index >= _dragStartFrom && index <= _dragStartFrom + _dragText.Length) { // re-make selection SelectionStart = _dragStartFrom; SelectionLength = _dragText.Length; var dataObject = new DataObject(); dataObject.SetText(_dragText, TextDataFormat.UnicodeText); dataObject.SetText(_dragText, TextDataFormat.Text); _dragFromThis = true; if (ModifierKeys == Keys.Control) { _dragRemoveOld = false; DoDragDrop(dataObject, DragDropEffects.Copy); } else if (ModifierKeys == Keys.None) { _dragRemoveOld = true; DoDragDrop(dataObject, DragDropEffects.Move); } } } }
0
6. Example
View licensepublic void CreateTextFormats() { OLVExporter exporter = this.CreateExporter(); // Put both the text and html versions onto the clipboard. // For some reason, SetText() with UnicodeText doesn't set the basic CF_TEXT format, // but using SetData() does. //this.SetText(sbText.ToString(), TextDataFormat.UnicodeText); this.SetData(exporter.ExportTo(OLVExporter.ExportFormat.TabSeparated)); string exportTo = exporter.ExportTo(OLVExporter.ExportFormat.CSV); if (!String.IsNullOrEmpty(exportTo)) this.SetText(exportTo, TextDataFormat.CommaSeparatedValue); this.SetText(ConvertToHtmlFragment(exporter.ExportTo(OLVExporter.ExportFormat.HTML)), TextDataFormat.Html); }
0
7. Example
View licensepublic void CreateTextFormats() { OLVExporter exporter = this.CreateExporter(); // Put both the text and html versions onto the clipboard. // For some reason, SetText() with UnicodeText doesn't set the basic CF_TEXT format, // but using SetData() does. //this.SetText(sbText.ToString(), TextDataFormat.UnicodeText); this.SetData(exporter.ExportTo(OLVExporter.ExportFormat.TabSeparated)); string exportTo = exporter.ExportTo(OLVExporter.ExportFormat.CSV); if (!String.IsNullOrEmpty(exportTo)) this.SetText(exportTo, TextDataFormat.CommaSeparatedValue); this.SetText(ConvertToHtmlFragment(exporter.ExportTo(OLVExporter.ExportFormat.HTML)), TextDataFormat.Html); }
0
8. Example
View licenseinternal static DataObject CreateHtmlFormatClipboardDataObject(string htmlFragment, string title = "/n ..... /n //View Source file for more details /n }
0
9. Example
View licensepublic void CreateTextFormats() { OLVExporter exporter = this.CreateExporter(); // Put both the text and html versions onto the clipboard. // For some reason, SetText() with UnicodeText doesn't set the basic CF_TEXT format, // but using SetData() does. //this.SetText(sbText.ToString(), TextDataFormat.UnicodeText); this.SetData(exporter.ExportTo(OLVExporter.ExportFormat.TabSeparated)); string exportTo = exporter.ExportTo(OLVExporter.ExportFormat.CSV); if (!String.IsNullOrEmpty(exportTo)) this.SetText(exportTo, TextDataFormat.CommaSeparatedValue); this.SetText(ConvertToHtmlFragment(exporter.ExportTo(OLVExporter.ExportFormat.HTML)), TextDataFormat.Html); }
0
10. Example
View licensepublic virtual object Copy() { // copy selected text in the selected annotation?/n ..... /n //View Source file for more details /n }
0
11. Example
View licensepublic static void SetIColorData(this IDataObject data, IEnumerable<IColorData> color) { if (!color.Any()) return; data.SetWrappedData(color.ToArray()); DataObject dataObj = data as DataObject; if (dataObj != null) { var rgbaQuery = color.Select(c => c.ConvertTo<ColorRgba>()); dataObj.SetText(rgbaQuery.ToString(c => string.Format("{0},{1},{2},{3}", c.R, c.G, c.B, c.A), ", ")); } }
0
12. Example
View licensepublic void CreateTextFormats() { IList<OLVColumn> columns = IncludeHidden/n ..... /n //View Source file for more details /n }
0
13. Example
View licensepublic void CreateTextFormats() { IList<OLVColumn> columns = IncludeHidden/n ..... /n //View Source file for more details /n }
0
14. Example
View licensepublic void CreateTextFormats() { IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }
0
15. Example
View licensepublic void CreateTextFormats() { IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }
0
16. Example
View licensepublic void CreateTextFormats() { IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }
0
17. Example
View licensepublic static void ClipboardStripHtmlStyles(){ if (!Clipboard.ContainsText(TextDataFormat.Html) || !Clipboard.ContainsText(TextDataFormat.UnicodeText)){ return; } string originalText = Clipboard.GetText(TextDataFormat.UnicodeText); string originalHtml = Clipboard.GetText(TextDataFormat.Html); string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty); int removed = originalHtml.Length-updatedHtml.Length; updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0')); DataObject obj = new DataObject(); obj.SetText(originalText, TextDataFormat.UnicodeText); obj.SetText(updatedHtml, TextDataFormat.Html); SetClipboardData(obj); }
0
18. Example
View licensepublic static void SetClipboardData(ISurface surface) { DataObject dataObject = /n ..... /n //View Source file for more details /n }