I needed to be able to use drag and drop within a FlowLayoutPanel for the rent program I am currently working on. Was a hard nut to crack (basicly beacuse I was stupid and there where slim to none information on how to do exactly this). Further down there are a rough (need to be polished with more test etc) demo code that shows how to do it.
To use it make a UserControl with a background color. Copy and paste this:
public partial class ucFlowLayoutDraggable : UserControl
AllowDrop = true;
protected override void OnMouseDown(MouseEventArgs e)
protected override void OnDragOver(DragEventArgs drgevent)
// is another dragable
FlowLayoutPanel p = (FlowLayoutPanel)Parent;
int myIndex = p.Controls.GetChildIndex(this);
On your form add a FlowLayoutPanel and set the AllowDrop property to true, add a couple of usercontrols to it (resize them to different sizes so that you can see what happens).
Really easy when you see the code 🙂