System.Windows.Forms.Clipboard.SetFileDropList(System.Collections.Specialized.StringCollection)

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

8 Examples 7

1. Example

Project: ImageGlass
Source File: frmMain.cs
View license
private void CopyFile()
        {
            try
            {
                if (GlobalSetting.IsImageError || !File.Exists(GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex)))
                {
                    return;
                }
            }
            catch { return; }

            GlobalSetting.StringClipboard = new StringCollection();
            GlobalSetting.StringClipboard.Add(GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex));
            Clipboard.SetFileDropList(GlobalSetting.StringClipboard);

            DisplayTextMessage(
                string.Format(GlobalSetting.LangPack.Items["frmMain._CopyFileText"],
                GlobalSetting.StringClipboard.Count), 1000);
        }

2. Example

Project: ImageGlass
Source File: frmMain.cs
View license
private void CopyMultiFiles()
        {
            try
            {
                if (GlobalSetting.IsImageError || !File.Exists(GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex)))
                {
                    return;
                }
            }
            catch { return; }

            //get filename
            string filename = GlobalSetting.ImageList.GetFileName(GlobalSetting.CurrentIndex);

            //exit if duplicated filename
            if (GlobalSetting.StringClipboard.IndexOf(filename) != -1)
            {
                return;
            }

            //add filename to clipboard
            GlobalSetting.StringClipboard.Add(filename);
            Clipboard.SetFileDropList(GlobalSetting.StringClipboard);

            DisplayTextMessage(
                string.Format(GlobalSetting.LangPack.Items["frmMain._CopyFileText"],
                GlobalSetting.StringClipboard.Count), 1000);
        }

3. Example

View license
private static void SaveClipboardPicture(IList<object> copiedObjs)
        {
            try
            {
                Logger.Log("Save clipboard begins.");
                foreach (var copiedObj in copiedObjs)
                {
                    if (copiedObj == null)
                    {
                        continue;
                    }

                    if (copiedObj is Image)
                    {
                        Clipboard.SetImage((Image)copiedObj);
                    }
                    else if (copiedObj is StringCollection)
                    {
                        Clipboard.SetFileDropList((StringCollection)copiedObj);
                    }
                    else if (!string.IsNullOrEmpty(copiedObj as string))
                    {
                        Clipboard.SetText((string)copiedObj);
                    }
                }
                Logger.Log("Save clipboard done.");
            }
            catch (Exception e)
            {
                // sometimes Clipboard may fail
                Logger.LogException(e, "SaveClipboardPicture");
            }
        }

4. Example

Project: Pscx
Source File: SetClipboardCommand.cs
View license
protected override void EndProcessing()
        {
            ExecuteWrite(delegate
            {
                switch (ParameterSetName)
                {
                    case ParamSetFiles:
                        if (_paths.Count == 0)
                            WinFormsClipboard.Clear();
                        else
                            WinFormsClipboard.SetFileDropList(_paths);
                        break;

                    case ParamSetImage:
                        if (_image == null)
                            WinFormsClipboard.Clear();
                        else
                            WinFormsClipboard.SetImage(_image);
                        break;

                    case ParamSetRtf:
                        SetTextContents(_rtf, TextDataFormat.Rtf);
                        break;

                    case ParamSetHtml:
                        SetTextContents(_html, TextDataFormat.Html);
                        break;

                    default:
                        SetTextContents(_text, TextDataFormat.UnicodeText);
                        break;
                }
            });
        }

5. Example

Project: vimage
Source File: ImageViewer.cs
View license
public void CopyFile()
        {
            Thread thread = new Thread(() =>
            {
                System.Collections.Specialized.StringCollection files = new System.Collections.Specialized.StringCollection();
                files.Add(File);
                Clipboard.SetFileDropList(files);
            });
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }

6. Example

View license
private void CopyAsFile(string output)
        {
            string fileName = this.PasteFileName;
            if (String.IsNullOrEmpty(fileName))
            {
                fileName = Path.ChangeExtension(Path.GetRandomFileName(), ".txt");
            }

            // illegal characters in filename?
            if (Array.TrueForAll(
                Path.GetInvalidFileNameChars(),
                invalidChar => !fileName.Contains(invalidChar.ToString())) == false)
            {
                ErrorHandler.ThrowIllegalCharsInPath(this.PasteFileName);
            }

            byte[] buffer = Encoding.UTF8.GetBytes(output);

            WriteVerbose(
                String.Format(
                    "Constructing file '{0}.' Length is {1} byte(s).",
                    fileName,
                    buffer.Length));

            string tempFile = Path.Combine(Path.GetTempPath(), fileName);

            using (var stream = FileHandler.OpenWrite(tempFile, false, true, true))
            {
                stream.Write(buffer, 0, buffer.Length);
            }

            ExecuteWrite(
                () => Clipboard.SetFileDropList(
                        new StringCollection {tempFile}));

        }

7. Example

Project: TeX2img
Source File: Program.cs
View license
static int CUIExec(bool q, List<string> files) {
            IOutputController Output = new CU/n ..... /n //View Source file for more details /n }

8. Example

Project: TeX2img
Source File: MainForm.cs
View license
private void convertWorker_DoWork(object sender, DoWorkEventArgs e) {
            Properties.Setting/n ..... /n //View Source file for more details /n }