Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Drag and Drop in C#

Drag and Drop in C#

Scheduled Pinned Locked Moved C#
csharpperformancetutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wrykyn
    wrote on last edited by
    #1

    Hello, I implemented drag and drop for some of my controls. I did it by having my controls implement IDataObject then using the usual mouse(up,down, move, etc) and drag(drop, leave, etc) events, in other controls/forms to accept the drop. While the control is being dragged its shown along with the mouse as a small square border with a small + sign next to it (I guess this is default). It looks like the small box is the representation of the control being dragged. I would like to show sometime else as the control is being dragged. I've been looking on MSDN and online and didn't find anything yet (they only talked about how to replace the mouse cursor for the drag operation). I really would like to avoid creating a form and moving that around with the mouse. Is there some handle to replace the default "object being dragged" state/box with something of my own choice. Thanks, Ramanan

    "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

    C 1 Reply Last reply
    0
    • W wrykyn

      Hello, I implemented drag and drop for some of my controls. I did it by having my controls implement IDataObject then using the usual mouse(up,down, move, etc) and drag(drop, leave, etc) events, in other controls/forms to accept the drop. While the control is being dragged its shown along with the mouse as a small square border with a small + sign next to it (I guess this is default). It looks like the small box is the representation of the control being dragged. I would like to show sometime else as the control is being dragged. I've been looking on MSDN and online and didn't find anything yet (they only talked about how to replace the mouse cursor for the drag operation). I really would like to avoid creating a form and moving that around with the mouse. Is there some handle to replace the default "object being dragged" state/box with something of my own choice. Thanks, Ramanan

      "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can replace the cursor with whatever you like, the Bitmap class has a GetHIcon method, or something like that, which converts it to an icon, which can then be passed to the Cursor constructor.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      W 1 Reply Last reply
      0
      • C Christian Graus

        You can replace the cursor with whatever you like, the Bitmap class has a GetHIcon method, or something like that, which converts it to an icon, which can then be passed to the Cursor constructor.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        W Offline
        W Offline
        wrykyn
        wrote on last edited by
        #3

        Thanks Christian, I also found a sample for this same method in Chris Sell's new Windows Forms book in an Appendix last evening.

        "One of the Georges," said Psmith, "I forget which, once said that a certain number of hours' sleep a day--I cannot recall for the moment how many--made a man something, which for the time being has slipped my memory."

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups