.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mouse Cursor while dragging from .Net ListView to AutoCAD drawing area?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
2216 Views, 5 Replies

Mouse Cursor while dragging from .Net ListView to AutoCAD drawing area?

Anonymous
Not applicable

Hi experts,

I have a ListView control from where I drag items to Drawing area. Whenever mouse leaves the ListView Control and enters the AutoCAD drawing area, AutoCAD claims the mouse cursor back to Cross Pointer.

Is it possible to change this cursor during drag operation to a pointer with some attachment? As normally happened in Windows Explorer while dragging and dropping files among folders.

 

Thanks a bunch.

Farrukh

0 Likes

Mouse Cursor while dragging from .Net ListView to AutoCAD drawing area?

Hi experts,

I have a ListView control from where I drag items to Drawing area. Whenever mouse leaves the ListView Control and enters the AutoCAD drawing area, AutoCAD claims the mouse cursor back to Cross Pointer.

Is it possible to change this cursor during drag operation to a pointer with some attachment? As normally happened in Windows Explorer while dragging and dropping files among folders.

 

Thanks a bunch.

Farrukh

5 REPLIES 5
Message 2 of 6
DiningPhilosopher
in reply to: Anonymous

DiningPhilosopher
Collaborator
Collaborator

You have a ListView where?  In an AutoCAD extension?  Or, in another application? 


@Anonymous wrote:

Hi experts,

I have a ListView control from where I drag items to Drawing area. Whenever mouse leaves the ListView Control and enters the AutoCAD drawing area, AutoCAD claims the mouse cursor back to Cross Pointer.

Is it possible to change this cursor during drag operation to a pointer with some attachment? As normally happened in Windows Explorer while dragging and dropping files among folders.

 

Thanks a bunch.

Farrukh


 

0 Likes

You have a ListView where?  In an AutoCAD extension?  Or, in another application? 


@Anonymous wrote:

Hi experts,

I have a ListView control from where I drag items to Drawing area. Whenever mouse leaves the ListView Control and enters the AutoCAD drawing area, AutoCAD claims the mouse cursor back to Cross Pointer.

Is it possible to change this cursor during drag operation to a pointer with some attachment? As normally happened in Windows Explorer while dragging and dropping files among folders.

 

Thanks a bunch.

Farrukh


 

Message 3 of 6
Anonymous
in reply to: DiningPhilosopher

Anonymous
Not applicable
Yes, its an AutoCAD Addin using C#
0 Likes

Yes, its an AutoCAD Addin using C#
Message 4 of 6
Anonymous
in reply to: Anonymous
Message 5 of 6
DiningPhilosopher
in reply to: Anonymous

DiningPhilosopher
Collaborator
Collaborator

You'll have to show the code you're using to start the drag and drop operation.

 

BTW, the drag & drop cursor is displayed by AutoCAD, not by your application, and has nothing to do with setting a wait cursor or setting any type of cursor yourself, in case you followed the link posted in another reply.

 

 

You'll have to show the code you're using to start the drag and drop operation.

 

BTW, the drag & drop cursor is displayed by AutoCAD, not by your application, and has nothing to do with setting a wait cursor or setting any type of cursor yourself, in case you followed the link posted in another reply.

 

 

Message 6 of 6
Anonymous
in reply to: DiningPhilosopher

Anonymous
Not applicable
Accepted solution

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.Smiley Happy

 

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

 

0 Likes

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.Smiley Happy

 

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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report