Please do not reply to this email- if you want to comment on the bug, go to the URL shown below and enter your comments there.
Changed by [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=82532 --- shadow/82532 2007-08-22 13:29:44.000000000 -0400 +++ shadow/82532.tmp.20616 2007-08-22 13:29:44.000000000 -0400 @@ -0,0 +1,230 @@ +Bug#: 82532 +Product: Mono: Class Libraries +Version: 1.2 +OS: +OS Details: Windows XP SP2 +Status: NEW +Resolution: +Severity: +Priority: Wishlist +Component: Windows.Forms +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: Drag & Drop using ListView throws exception + +Please fill in this template when reporting a bug, unless you know what +you are doing. +Description of Problem: +unhandled System.Exception occurs when trying to use drag & drop with a +ListView control when running Mono unser Windows XP. + +Steps to reproduce the problem: +1. Create a windows form application with Visual Studio 2003 in C# using +a ListView control that supports drag & drop. +2. Run the application using mono +3. Drag & drop some files onto the listview control. + +Actual Results: +Throws the following exception: + +C:\Development\Prototypes\TestMono\TestMono\bin\Debug>mono --debug +testmono.exe + +Unhandled Exception: System.Exception: Yeah baby, gimme a ride to +WM_DROPFILES l +and + at System.Windows.Forms.Win32DnD+ComIDropTarget.Drop (IntPtr this, +IntPtr pDat +aObj, UInt32 grfkeyState, IntPtr pt_x, IntPtr pt_y, IntPtr pdwEffect) +[0x00000] +in C:\cygwin\tmp\scratch\mono-1.2.4 +\mcs\class\Managed.Windows.Forms\System.Windo +ws.Forms\Win32DnD.cs:792 + at (wrapper native-to-managed) ComIDropTarget:Drop +(intptr,intptr,uint,intptr, +intptr,intptr) + at <0x00000> <unknown method> + at (wrapper managed-to-native) +System.Windows.Forms.XplatUIWin32:Win32Dispatch +Message (System.Windows.Forms.MSG&) + at System.Windows.Forms.XplatUIWin32.DispatchMessage +(System.Windows.Forms.MSG +& msg) [0x00000] in C:\cygwin\tmp\scratch\mono-1.2.4 +\mcs\class\Managed.Windows.F +orms\System.Windows.Forms\XplatUIWin32.cs:1757 + at System.Windows.Forms.XplatUI.DispatchMessage +(System.Windows.Forms.MSG& msg +) [0x00000] in C:\cygwin\tmp\scratch\mono-1.2.4 +\mcs\class\Managed.Windows.Forms\ +System.Windows.Forms\XplatUI.cs:437 + at System.Windows.Forms.Application.RunLoop (Boolean Modal, +System.Windows.For +ms.ApplicationContext context) [0x002db] in C:\cygwin\tmp\scratch\mono- +1.2.4\mcs +\class\Managed.Windows.Forms\System.Windows.Forms\Application.cs:645 + at System.Windows.Forms.Application.Run (System.Windows.Forms.Form +mainForm) [ +0x00000] in C:\cygwin\tmp\scratch\mono-1.2.4 +\mcs\class\Managed.Windows.Forms\Sys +tem.Windows.Forms\Application.cs:499 + at TestMono.Form1.Main () [0x00000] + + +Expected Results: +Application doesn't crash. + +How often does this happen? +Every time. + + +Additional Information: + +C# Source Code Follows: + +using System; +using System.Drawing; +using System.Collections; +using System.ComponentModel; +using System.Windows.Forms; +using System.Data; + +namespace TestMono +{ + /// <summary> + /// Summary description for Form1. + /// </summary> + public class Form1 : System.Windows.Forms.Form + { + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.Label label1; + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.Container components = null; + + public Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after +InitializeComponent call + // + } + + /// <summary> + /// Clean up any resources being used. + /// </summary> + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + #region Windows Form Designer generated code + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.listView1 = new System.Windows.Forms.ListView +(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.AllowDrop = true; + this.listView1.Location = new System.Drawing.Point +(32, 48); + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size +(664, 288); + this.listView1.TabIndex = 0; + this.listView1.DragDrop += new +System.Windows.Forms.DragEventHandler(this.listView1_DragDrop); + this.listView1.DragEnter += new +System.Windows.Forms.DragEventHandler(this.listView1_DragEnter); + // + // label1 + // + this.label1.Location = new System.Drawing.Point +(32, 16); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(664, +24); + this.label1.TabIndex = 1; + this.label1.Text = "Drag & drop an image into the +listbox below. This action results in a WM_DROPFIL" + + "ES exception when running under mono."; + // + // Form1 + // + this.AutoScaleBaseSize = new System.Drawing.Size +(5, 13); + this.ClientSize = new System.Drawing.Size(728, +374); + this.Controls.Add(this.label1); + this.Controls.Add(this.listView1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + + } + #endregion + + /// <summary> + /// The main entry point for the application. + /// </summary> + [STAThread] + static void Main() + { + Application.Run(new Form1()); + } + + private void listView1_DragDrop(object sender, +System.Windows.Forms.DragEventArgs e) + { + try + { + Object o = e.Data.GetData +(DataFormats.FileDrop); + + if (o != null) + { + // Get the list of +files/directories to import + string[] fileList = (string[])o; + } + } + catch(Exception exception) + { + MessageBox.Show("Exception occurred in +OnDragDrop: " + exception.Message); + } + } + + private void listView1_DragEnter(object sender, +System.Windows.Forms.DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + e.Effect = DragDropEffects.Copy; + } + } + } +} _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
