[Mono-winforms-list] drag and drop file to desktop doesn't work

Stifu stifu at free.fr
Mon Jul 25 04:19:09 EDT 2011


Most likely a Mono bug. At some point, dragging from the desktop to the app
didn't work, but it got fixed a little while ago. Didn't try the other way
around.

For the record, the Mono team doesn't work on WinForms anymore, so patches
have to come from the community.


treedevil wrote:
> 
> 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-tp3691711p3691897.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.


More information about the Mono-winforms-list mailing list