Results 1 to 6 of 6

Thread: Drag , Drop Create?

  1. #1

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335

    Drag , Drop Create?

    OK I need to learn how do drag or copy lets say a label or picture or even a custom control from form1 to form2. How wold i do this?i want it to be changleable like can i make a you know a html program where you drag the control onto a blank form and it copys or creates a default 1 there with its own propertys. How do i do that? PLZ help
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  2. #2
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    I'm not sure about draggin from form to form, but what if you were to create a clipboard affect, where you could cut and paste objects.

    When an object is cut, just store its attributes in a global variable.

  3. #3
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    For drag and drop between programs, you will need to load the OLE data structure with information.
    For example, dragging and dropping from / to Windows Explorer passes filenames - and the receiving program can do what it likes with these.


    The data that has been packaged by the dragged from application, is available to the dropped on application, although it must be decoded first.
    For Example: To identify a list of files from Windows Explorer use the following:
    VB Code:
    1. If Data.GetFormat(15) Then
    2. 'Format 15 is an array of names from WinExplorer
    3.         MsgBox = Data.Files(1)
    4.         For i = 2 To Data.Files.Count
    5.           MsgBox Data.Files(i)
    6.         Next i
    7.         Data.Files.Clear
    8.     End If
    The Format numbers used in the OLE DragDrop data structure, are:
    Text = 1 (vbCFText)
    Bitmap = 2 (vbCFBitmap)
    Metafile = 3
    Emetafile = 14
    DIB = 8
    Palette = 9
    Files = 15 (vbCFFiles)
    RTF = -16639

    If you want to drop files from your application back to Windows Explorer, the following will load the correct data structure with the file names (full names plus path are needed). Remember: Dropping these filenames onto Windows Explorer will initiate a copy operation.
    VB Code:
    1. Data.Files.Add "C:\Temp\Myfile1.TXT", 1
    2. Data.Files.Add "C:\Temp\Yourfile2.TXT", 2
    3. Data.SetData , 15
    SO, pick your data type depending on what you are dragging; load the structure; drag and drop; and test the resulting structure in the receiving program.

  4. #4

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335

    Not that

    Your not understanding me. All i want to do is Drag a command button from point a ----------to point b. But when i drop it i want it to create a new instance of the button.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  5. #5
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Are you in the development environment of VB?

    If so, click the control you want. Press Cntrl C to copy it.
    Click where you want it (on the other form). Press Cntrl V to paste. Then move it to the required location.

  6. #6

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    no i want this done at runtime. Like to drag a control and copy it to the new form. Or


    Heres what i need the i want to be able to creat a new button on a form in runtime how?

    If i click command1 i want it to then create a new button on form 2 and have that buton moveable . How do i do that. I guess i should make the buton a array some how?
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

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