[Mono-winforms-list] winform drag and drop functionality
Stifu
stifu at free.fr
Wed Feb 22 13:13:16 UTC 2012
Must be a Mono bug, then. It might be OS specific, but you didn't specify the
OS.
PS: Note that you don't need to recompile your app with Mono in order to run
it with Mono.
savita wrote
>
> Hi,
>
> We have developed a drag and drop functionality in .net win form using c#.
> drag sourse is list box
> drag target is textbox.
>
> It doesn't give any error when compiled in mono. However the drag and drop
> functionality doesn't work in mono. The text in texbox set as a blank when
> dragged a list item from listbox. It works fine in .net.
> Kindly help and let me know what I am missing.
>
> I have set the
>
> this.textBox1.AllowDrop = true;
> this.listBox1.MouseDown += new
> System.Windows.Forms.MouseEventHandler(this.listBox1_MouseDown);
> this.textBox1.DragDrop += new
> System.Windows.Forms.DragEventHandler(this.textBox1_DragDrop);
> this.textBox1.DragEnter += new
> System.Windows.Forms.DragEventHandler(this.textBox1_DragEnter);
> --------------------------------------------
> public Form1()
> {
> InitializeComponent();
> listBox1.Items.Add("ABC");
> listBox1.Items.Add("XYZ");
> listBox1.Items.Add("AAA");
> }
>
> private void textBox1_DragEnter(object sender, DragEventArgs e)
> {
> if (e.Data.GetDataPresent(DataFormats.Text))
> e.Effect = DragDropEffects.Copy;
> else
> e.Effect = DragDropEffects.None;
>
> }
>
> private void textBox1_DragDrop(object sender, DragEventArgs e)
> {
>
> textBox1.Text =
> (string)e.Data.GetData(DataFormats.StringFormat); ;
>
> }
>
>
>
> private void listBox1_MouseDown(object sender, MouseEventArgs e)
> {
>
> listBox1.DoDragDrop(listBox1.SelectedItem.ToString(),
> DragDropEffects.Copy);
>
>
> }
> ---------------------------------------------------------
>
> Note : I have also refered the 'Dragging Text' code from
> http://zetcode.com/tutorials/monowinformstutorial/dragdrop/ . This also
> doesn't work when compiled in mono.
>
--
View this message in context: http://mono.1490590.n4.nabble.com/winform-drag-and-drop-functionality-tp4410189p4410231.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.
More information about the Mono-winforms-list
mailing list