I've built a little example which allows you to drag listview items around ( in large icon view ) and drop them at any given point of the same listview...
VB Code:
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint="SendMessageA")]
[Color=Blue]static[/color] [Color=Blue]extern[/color] [Color=Blue]int[/color] SendMessage (System.IntPtr hwnd, [Color=Blue]int[/color] wMsg, [Color=Blue]int[/color] wParam,[Color=Blue]ref[/color] Point lParam);
[Color=Blue]const[/color] [Color=Blue]int[/color] LVM_SETITEMPOSITION32 = (0x1000 + 49);
[Color=Blue]private[/color] [Color=Blue]void[/color] ListView1_ItemDrag([Color=Blue]object[/color] sender, System.Windows.Forms.ItemDragEventArgs e)
{
ListViewItem lvi =(ListViewItem)e.Item;
ListView1.DoDragDrop([Color=Blue]new[/color] DataObject("System.Windows.Forms.ListViewItem", lvi), DragDropEffects.Move);
}
[Color=Blue]private[/color] [Color=Blue]void[/color] ListView1_DragEnter([Color=Blue]object[/color] sender, System.Windows.Forms.DragEventArgs e)
{
[Color=Blue]if[/color](e.Data.GetDataPresent("System.Windows.Forms.ListViewItem"))
{
e.Effect = DragDropEffects.Move;
}
}
[Color=Blue]private[/color] [Color=Blue]void[/color] ListView1_DragOver([Color=Blue]object[/color] sender, System.Windows.Forms.DragEventArgs e)
{
ListViewItem lvi =(ListViewItem)e.Data.GetData("System.Windows.Forms.ListViewItem");
Point pnt=[Color=Blue]new[/color] Point(e.X - ([Color=Blue]this[/color].Location.X + ListView1.Location.X + 40), e.Y - ([Color=Blue]this[/color].Location.Y + ListView1.Location.Y + 75));
SendMessage(ListView1.Handle, LVM_SETITEMPOSITION32, lvi.Index,[Color=Blue]ref[/color] pnt);
e.Effect = DragDropEffects.Move;
}
i've included a source project ...