Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

DragN'Drop don't get properties

$
0
0
Hi,

I have the following code:
button1.MouseDown += new MouseEventHandler(pbox_MouseDown);
button1.DragOver += new DragEventHandler(pbox_DragOver);
 void pbox_MouseDown(object sender, MouseEventArgs e)
        {
            base.onmousedown(e);
            DoDragDrop(sender, DragDropEffects.All);
        }
void pbox_DragOver(object sender, DragEventArgs e)
        {
            base.ondragOver(e);
            // is another dragable
            if (e.Data.GetData(typeof(Button)) != null)
            {
                FlowLayoutPanel p = (FlowLayoutPanel)(sender as Button).Parent;
                //Current Position             
                int myIndex = p.Controls.GetChildIndex((sender as Button));

                //Dragged to control to location of next picturebox
                Button q = (Button)e.Data.GetData(typeof(Button));
                p.Controls.SetChildIndex(q, myIndex);
            }
        }


My problem is that it re-orders confortably, but when I click the button to the what I want he does nothing. I think it might be because when the button is re-order it doesn't get the properties!

Without the re-order, my click button runs perfectly. How can I solve it?
Thanks!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>