Drag and drop Cursor in C# Windows Forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sCryptKeeper
    New Member
    • Feb 2008
    • 1

    Drag and drop Cursor in C# Windows Forms

    I'm trying to change the cursor while a drag and drop occurs between two lists in a winforms. I tried several ways (several tutorial and solutions) found over the web.

    I even tried to simply change the cursor when the form loads. But as soon as the mouse moves, the cursor is back to default.

    I use the following events for my drag and drop.

    this.MatchRequi sitionListView. MouseUp += new System.Windows. Forms.MouseEven tHandler(this.M atchRequisition ListView_MouseU p);
    this.MatchRequi sitionListView. DragDrop += new System.Windows. Forms.DragEvent Handler(this.Ma tchRequisitionL istView_DragDro p);
    this.MatchRequi sitionListView. MouseMove += new System.Windows. Forms.MouseEven tHandler(this.M atchRequisition ListView_MouseM ove);
    this.MatchRequi sitionListView. MouseDown += new System.Windows. Forms.MouseEven tHandler(this.M atchRequisition ListView_MouseD own);
    this.MatchRequi sitionListView. DragEnter += new System.Windows. Forms.DragEvent Handler(this.Ma tchRequisitionL istView_DragEnt er);

    I use this to change the cursor (didn't found a way to put and use a .cur from the LocalRessources )

    IntPtr hCursor = LoadCursorFromF ile("D:\\dev\\i esidebar\\trunk \\Taleo.Plugins .IESideBar.Shar ed\\Resources\\ 3dsmove.ico");
    Cursor.Current = new Cursor(hCursor) ;

    Even If I put this anywhere in my code, the only thing I managed to do is change the cursor on MouseDown. But as soon as I move the mouse, the dragDrop cursor is shown.

    As anyone managed to do this?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    I just tried a number of different things and couldn't get anything but the normal drag and drop icons. I got the "no" sign (circle with slash through it) the drag-copy icon and the drag-move icon, but couldn't change my custom ones.


    Oh, and:
    System.Windows. Forms.Cursors
    has a list of all the system cusors to use if need be.

    Comment

    Working...