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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. drag-drop How?

drag-drop How?

Scheduled Pinned Locked Moved C#
helptutorialquestion
2 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.
  • B Offline
    B Offline
    ben2
    wrote on last edited by
    #1

    I want to drag and drop files onto my usercontrol. I want to know which eventhandler to write in this case and how to get file info in that handler? Help please

    A 1 Reply Last reply
    0
    • B ben2

      I want to drag and drop files onto my usercontrol. I want to know which eventhandler to write in this case and how to get file info in that handler? Help please

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      This is a very simple thing to accomplish. Have you searched MSDN?? Some helpers: Control.AllowDrop - Gets or sets a value indicating whether the control can accept data that the user drags onto it. Control.DragDrop Event - Occurs when a drag-and-drop operation is completed. The event handler receives an argument of type DragEventArgs containing data related to this event. One of the properties of DragEventArgs is Data. Use it to get the IDataObject that contains the data associated with this event. Check for file drop, and use...

      if (e.Data.GetDataPresent(DataFormats.FileDrop))
      {
      string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
      }

      Just look at this: MSDN link[^] This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy

      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