CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Drag and Drop

  1. #1
    Join Date
    Jul 2003
    Posts
    9

    Question Drag and Drop

    Does anyone know how to drag and drop like Windows explorer does? I can do drag and dropping of filenames using:

    Data.Files.Add (location of file)
    Data.SetData , vbCFFILes

    But I want to get more in depth and do it like Windows Explorer. The source I am dropping too acts differently if the file is dragged and dropped like a windows explorer file. Thank you for your time.

  2. #2
    Join Date
    Jul 2003
    Location
    I'm Here!
    Posts
    31
    Here's an example using a textbox where user has highlighted a certain portion of the textbox for dragging:

    On the Text1 control's Mouse Up event:

    Code:
          If Text1.SelStart > 0 Then
            Text1.DragIcon = LoadPicture("path of whatever icon you want to use")
           Text1.Drag vbBeginDrag
          End If

    On the receiving control's DragDrop event, let's call it Text2:

    Code:
      ' Copy your info here
      Text2.Text = Text1.SelText
      Text2.Drag vbEndDrag
      Text2.DragIcon = Nothing

  3. #3
    Join Date
    Jul 2003
    Posts
    9
    Thank you for the help, but I don't want to physically move things. I am looking for some OLEDrag implementation.

    I do the above mentioned code and I drag and drop the file fine into another application. But, the file I drag and drop acts differently under OLEDrag operation then it does in Windows Explorer. Does anyone have any ideas about this.

    THank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured