|
-
Nov 3rd, 2002, 06:24 PM
#1
Thread Starter
Frenzied Member
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/
-
Nov 3rd, 2002, 07:09 PM
#2
Software Eng.
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.
-
Nov 4th, 2002, 05:56 AM
#3
Frenzied Member
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:
If Data.GetFormat(15) Then
'Format 15 is an array of names from WinExplorer
MsgBox = Data.Files(1)
For i = 2 To Data.Files.Count
MsgBox Data.Files(i)
Next i
Data.Files.Clear
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:
Data.Files.Add "C:\Temp\Myfile1.TXT", 1
Data.Files.Add "C:\Temp\Yourfile2.TXT", 2
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.
-
Nov 4th, 2002, 07:37 AM
#4
Thread Starter
Frenzied Member
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/
-
Nov 4th, 2002, 07:45 AM
#5
Frenzied Member
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.
-
Nov 5th, 2002, 08:14 AM
#6
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|