[Mono-winforms-list] drag and drop file to desktop doesn't work
    treedevil 
    brett.raven at solentive.com
       
    Mon Jul 25 02:16:47 EDT 2011
    
    
  
Hi,
Mono-newbie, so please bear with me!
I have a simple C# winform app (.net 3.5) that populates a listbox with the
files from a folder. The goal is to drag and drop a selected file FROM the
app TO the desktop (or another app), which this does in normal run mode.
When I run it under Mono - I cannot drag nor drop the filename. My code is
as below (simple form with a single list box). It populates the list box
fine, but no dragging available:
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            string[] filePaths = Directory.GetFiles(@"C:\TEMP\");
            listBox1.DataSource = filePaths;
        }
        private void listBox1_MouseDown(object sender, MouseEventArgs e)
        {
              StringCollection fileList = new StringCollection();
              fileList.Add(listBox1.SelectedItem.ToString());
              DataObject dataObj = new DataObject();  
              dataObj.SetFileDropList(fileList);  
              listBox1.DoDragDrop(dataObj, DragDropEffects.Copy);
        }
        private void listBox1_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.Copy;
        }
    }
--
View this message in context: http://mono.1490590.n4.nabble.com/drag-and-drop-file-to-desktop-doesn-t-work-tp3691711p3691711.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
    
    
More information about the Mono-winforms-list
mailing list