System.Windows.Forms.DataObject.SetText(string, System.Windows.Forms.TextDataFormat)

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 7

1. Example

Project: Bulk-Crap-Uninstaller
Source File: DragSource.cs
View license
public void CreateTextFormats() {
            IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }

2. Example

Project: TweetDuck
Source File: WindowsUtils.cs
View license
public static void SetClipboard(string text, TextDataFormat format){
            if (string.IsNullOrEmpty(text)){
                return;
            }

            DataObject obj = new DataObject();
            obj.SetText(text, format);
            SetClipboardData(obj);
        }

3. Example

Project: ClearCanvas
Source File: GalleryView.cs
View license
private 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);
		}

4. Example

View license
public 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);
        }

5. Example

Project: subtitleedit
Source File: SETextBox.cs
View license
private 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);
                    }
                }
            }
        }

6. Example

Project: logwizard
Source File: OLVDataObject.cs
View license
public 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);
        }

7. Example

Project: SquareOne
Source File: OLVDataObject.cs
View license
public 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);
        }

8. Example

Project: gitextensions
Source File: HtmlFragment.cs
View license
internal static DataObject CreateHtmlFormatClipboardDataObject(string htmlFragment, string title = "/n ..... /n //View Source file for more details /n }

9. Example

Project: MapViewer
Source File: OLVDataObject.cs
View license
public 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);
        }

10. Example

Project: ATF
Source File: CircuitEditingContext.cs
View license
public virtual object Copy()
        {
            // copy selected text in the selected annotation?/n ..... /n //View Source file for more details /n }

11. Example

Project: duality
Source File: ExtMethodsDataObject.cs
View license
public 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), ", "));
			}
		}

12. Example

Project: tesvsnip
Source File: OLVDataObject.cs
View license
public void CreateTextFormats()
        {
            IList<OLVColumn> columns = IncludeHidden/n ..... /n //View Source file for more details /n }

13. Example

Project: falloutsnip
Source File: OLVDataObject.cs
View license
public void CreateTextFormats()
        {
            IList<OLVColumn> columns = IncludeHidden/n ..... /n //View Source file for more details /n }

14. Example

Project: logwizard
Source File: DragSource.cs
View license
public void CreateTextFormats() {
            IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }

15. Example

Project: SquareOne
Source File: DragSource.cs
View license
public void CreateTextFormats() {
            IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }

16. Example

Project: MapViewer
Source File: DragSource.cs
View license
public void CreateTextFormats() {
            IList<OLVColumn> columns = this.IncludeHiddenCol/n ..... /n //View Source file for more details /n }

17. Example

Project: TweetDuck
Source File: WindowsUtils.cs
View license
public 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);
        }

18. Example

Project: ShareX
Source File: ClipboardHelper.cs
View license
public static void SetClipboardData(ISurface surface)
        {
            DataObject dataObject = /n ..... /n //View Source file for more details /n }