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

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

11 Examples 7

1. Example

Project: gitextensions
Source File: RevisionFileTree.cs
View license
private void tvGitTree_ItemDrag(object sender, ItemDragEventArgs e)
        {
            var gitItem = (e.Item as TreeNode)?.Tag as GitItem;
            if (gitItem == null)
            {
                return;
            }

            var fileList = new StringCollection();
            var fileName = Path.Combine(Module.WorkingDir, gitItem.FileName);

            fileList.Add(fileName.ToNativePath());

            var obj = new DataObject();
            obj.SetFileDropList(fileList);

            DoDragDrop(obj, DragDropEffects.Copy);
        }

2. Example

Project: BSA_Browser
Source File: BSABrowser.cs
View license
private void lvFiles_ItemDrag(object sender, ItemDragEventArgs e)
        {
            if (!(lvFiles.SelectedIndices.Count >= 1))
                return;

            var obj = new DataObject();
            var sc = new StringCollection();

            foreach (int index in lvFiles.SelectedIndices)
            {
                var fe = _files[index];
                string dest = Program.CreateTempDirectory();

                fe.Extract(dest, false);
                sc.Add(Path.Combine(dest, fe.FileName));
            }

            obj.SetFileDropList(sc);
            lvFiles.DoDragDrop(obj, DragDropEffects.Move);
        }

3. Example

Project: sharpshell
Source File: TestShellForm.cs
View license
private void DoTestMenu(ShellItem item, int x, int y)
        {
            //  If we don't have a c/n ..... /n //View Source file for more details /n }

4. Example

Project: fomm
Source File: BSABrowser.cs
View license
private void lvFiles_ItemDrag(object sender, ItemDragEventArgs e)
    {
      if (lvFiles.SelectedItems.Count != 1)
      {
        return;
      }
      var fe = (BSAFileEntry) lvFiles.SelectedItems[0].Tag;
      var path = Path.Combine(Program.CreateTempDirectory(), fe.FileName);
      fe.Extract(path, false, br, ContainsFileNameBlobs);

      var obj = new DataObject();
      var sc = new StringCollection();
      sc.Add(path);
      obj.SetFileDropList(sc);
      lvFiles.DoDragDrop(obj, DragDropEffects.Move);
    }

5. Example

View license
public virtual DataObject GetClipboardValue()
        {
            var dataObj = new DataObject("Preferred DropEffect", DragDropEffects.Move); // "Cut" file to clipboard
            if (_contentType.IsCertificate()) // Common logic for .cer and .pfx
            {
                var tempPath = Path.Combine(Path.GetTempPath(), Name + _contentType.ToExtension());
                SaveToFile(tempPath);
                var sc = new StringCollection();
                sc.Add(tempPath);
                dataObj.SetFileDropList(sc);
            }
            return dataObj;
        }

6. Example

Project: bdhero
Source File: ExternalDragProvider.cs
View license
private void OnMouseMove(object sender, MouseEventArgs args)
        {
            if (!_leftMouseDown)
            {
                return;
            }
            if (_isAttached)
            {
                return;
            }
            if (_path == null)
            {
                return;
            }
            if (Math.Abs(args.X - _startPos.X) < Threshold &&
                Math.Abs(args.Y - _startPos.Y) < Threshold)
            {
                return;
            }

            var paths = new StringCollection { _path };
            var dataObject = new DataObject();

            dataObject.SetFileDropList(paths);
            dataObject.SetText(_path);

            // Allow other classes to check if the DragDrop event was generated by this class
            dataObject.SetData(typeof(Format), new Format());

            _dragSource.DoDragDrop(dataObject, DragDropEffects.Copy);

            _isAttached = true;
        }

7. Example

Project: duality
Source File: ExtMethodsDataObject.cs
View license
public static void SetFiles(this DataObject data, IEnumerable<string> files)
		{
			var sc = new System.Collections.Specialized.StringCollection();
			foreach (string file in files)
			{
				string path = Path.GetFullPath(file);
				if (File.Exists(path) || Directory.Exists(path))
				{
					sc.Add(path);
				}
			}
			if (sc.Count > 0) data.SetFileDropList(sc);
		}

8. Example

Project: ImageGlass
Source File: frmMain.cs
View license
private void CutFile()
        {
            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));

            byte[] moveEffect = new byte[] { 2, 0, 0, 0 };
            MemoryStream dropEffect = new MemoryStream();
            dropEffect.Write(moveEffect, 0, moveEffect.Length);

            DataObject data = new DataObject();
            data.SetFileDropList(GlobalSetting.StringClipboard);
            data.SetData("Preferred DropEffect", dropEffect);

            Clipboard.Clear();
            Clipboard.SetDataObject(data, true);

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

9. Example

Project: ImageGlass
Source File: frmMain.cs
View license
private void CutMultiFiles()
        {
            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);

            byte[] moveEffect = new byte[] { 2, 0, 0, 0 };
            MemoryStream dropEffect = new MemoryStream();
            dropEffect.Write(moveEffect, 0, moveEffect.Length);

            DataObject data = new DataObject();
            data.SetFileDropList(GlobalSetting.StringClipboard);
            data.SetData("Preferred DropEffect", dropEffect);

            Clipboard.Clear();
            Clipboard.SetDataObject(data, true);

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

10. Example

Project: AzureKeyVaultExplorer
Source File: Utils.cs
View license
public static void ClipboardSetHyperlink(string link, string name)
        {
            // HTML format which works fine with any Office product
            const string html = @"Version:0.9
                StartHTML:<<<<<<<1
                EndHTML:<<<<<<<2
                StartFragment:<<<<<<<3
                EndFragment:<<<<<<<4
                SourceURL: {0}
                <html>
                <body>
                <!--StartFragment-->
                <a href='{0}'>{1}</a>
                <!--EndFragment-->
                </body>
                </html>";
            var dataObj = new DataObject("Preferred DropEffect", DragDropEffects.Move); // "Cut" file to clipboard
            dataObj.SetData(DataFormats.Text, link);
            dataObj.SetData(DataFormats.UnicodeText, link);
            // Add HTML format and .URL as a file
            dataObj.SetData(DataFormats.Html, string.Format(html, link, name));
            var tempPath = Path.Combine(Path.GetTempPath(), name + ContentType.KeyVaultLink.ToExtension());
            File.WriteAllText(tempPath, $"[InternetShortcut]\r\nURL={link}\r\nIconIndex=47\r\nIconFile=%SystemRoot%\\system32\\SHELL32.dll");
            var sc = new StringCollection();
            sc.Add(tempPath);
            dataObj.SetFileDropList(sc);
            Clipboard.SetDataObject(dataObj, true);
        }

11. Example

Project: gitextensions
Source File: FileStatusList.cs
View license
void FileStatusListView_MouseMove(object sender, MouseEventArgs e)
        {
            ListView li/n ..... /n //View Source file for more details /n }