Ahhh, finally I solved it :). I was trying to change the mouse cursor from Cross to Pointer with attachement (i.e. Copying).
Got the tip from Managing drag & drop from a palette into AutoCAD using .NET.
In our mouse event handler we have to call AutoCAD's Application.DoDragDrop method. Here is my implemention which worked as expected.
// lv_Symbols: ListView control
void lv_Symbols_ItemDrag(object sender, ItemDragEventArgs e)
{
lv_SelectedItem = e.Item as ListViewItem;
if (lv_SelectedItem != null)
{
Autodesk.AutoCAD.ApplicationServices.Application.DoDragDrop(this.lv_Symbols, "", DragDropEffects.Copy, new DroplvSymbols(lv_SelectedItem.Tag.ToString()));
}
}
Second parameter (DragDropEffects) is used to chagge the mouse cursor, which exactly I wanted.
Last parameter of DoDragDrop is another class which is handling our Drop event. Here is the listings:
public class DroplvSymbols : Autodesk.AutoCAD.Windows.DropTarget
{
private string cmd; //This would be send to ACAD active document
// Constructor
public DroplvSymbols(string ListViewItemTag)
{
this.cmd = ListViewItemTag;
}
//Handling Drop event. We send AutoCAD a command here.
public override void OnDrop(DragEventArgs e)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
doc.SendStringToExecute(cmd, true, false, false);
}
}
I hope it would be beneficial for others too :).
Thanks all for your efforts.
Regards
Farrukh