drag and drop part II

I have learned how to drag and drop a picture to a form from a directory.  I am trying to find out how to drag and drop one smaller picture onto a larger picture on the same form.  Also, I want to be able to drag and drop this smaller picture several times.  Any ideas.
lpetrowiczAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

justchat_1Commented:
What code are you using to drag and drop the picture?
0
lpetrowiczAuthor Commented:
well, I found a file online and what it did was allow you to paste to a form from a file directory.  I want to be able to have a picture of a car on a form and then have a set of graphics that I can choose from on the same form and then drag and drop them onto the car and be able to use the same graphic again if I wanted to.  I don't actually have any code yet for that.
0
justchat_1Commented:
I helped you with the last question... if you needed code all you had to do was post back there:

So let me make sure I understand what you need:
1. drag pictures from a toolbar to a form
2. drag pictures from a directory onto the form
3. be able to move those pictures around on a form

...did I miss anything?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

justchat_1Commented:
As far as dragging and dropping onto a form, this is probably what you had in mind:
http://www.vbaccelerator.com/home/vb/Code/Controls/ImageList/Custom_Drag-Drop_Images_Using_ImageLists/article.asp
(note you will need to download and register vbalIml6.ocx)

That only drag and drops the pictures as text, im working on the code to make that images... until then check out that link and let me know if thats closer to what you wanted...
0
justchat_1Commented:
Ok using that code make the following changes:

1. remove the text box from the form
2. set the oledropmode property of the form to manual
3.  replace the old methods with these updated methods;

Private Sub picDragDrop_OLECompleteDrag(Effect As Long)
   '
   'm_cDrag.CompleteDrag
   '
End Sub

Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim pic As StdPicture
Set pic = ilsIcons.ItemPicture(Data.GetData(vbCFText) + 1)
m_cDrag.CompleteDrag
frmImageListDragDrop.PaintPicture pic, X, Y, pic.Width, pic.Height
End Sub
0
justchat_1Commented:
To test it just drag the icons on to the form...
0
burakiewiczCommented:
put 2 different images on the form:image1,image2

make image1 an control array and add your pictures to the images
on the image1_mousedown  put
image1(index).drag

on image 2 set
image2_dragdrop()

image2.picture=source.picture
0
justchat_1Commented:
^ that doesnt allow the pictures to stay on the forms ^
0
burakiewiczCommented:
the pictures never move or leave the form
0
justchat_1Commented:
can you expand on your comment-what was that in response to?
0
lpetrowiczAuthor Commented:
burakiewicz,

I need a little more clearer explanation please.  Your info sounds great just a little confrusing.  New to it all.
0
justchat_1Commented:
Did you have a chance to look at the link I posted?
0
lpetrowiczAuthor Commented:
I did and I downloaded the file and the file didn't work.  I was going to see what the code looked like on it to help guide me.  Throught the use of my two books, I have been able to understand a few things but this drag and drop thing is crazy.
0
lpetrowiczAuthor Commented:
does anyone have an example  drag and drop program they could send to me as an example to look at?
0
justchat_1Commented:
The program is exactly what you are trying to make not just the drag and drop the whole placing images...

You need to download and register this dll also (I guessed you missed the comment):
http://www.vbaccelerator.com/home/vb/Code/Controls/ImageList/vbAccelerator_Image_List_Control/VB6_ImageList_Control_Binary.zip

Once you have that working make the code corrections I posted and it will work exactly the way you described in drag & drop part I
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
burakiewiczCommented:
start a new project

add to images to the form


image1 make a ontrol array like
image1(0)
image1(1) and so on

image2 make the big picture
copy this

Private Sub Image2_DragDrop(Source As Control, X As Single, Y As Single)
Image2.Picture = Source.Picture
End Sub


and this

Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1(Index).Drag
End Sub
0
lpetrowiczAuthor Commented:
burakiewicz,

I did exactly as you had written.  The control array did drag and drop and it stayed so I could use it again as well.  There was only one problem.  When I dragged and dropped it on the main picture, the main picture disappeared.
0
lpetrowiczAuthor Commented:
justchat 1,

I did finally get your idea to work and thank you.  The only problem with that is that there is no main picture to drag it to and it doesn't quite get placed where I would like it to.
0
justchat_1Commented:
You need to paint the main picture onto the form... Pictures boxes will get painted over
0
lpetrowiczAuthor Commented:
paint the picture on??????
0
justchat_1Commented:
notice this code (in my list of corrections):
frmImageListDragDrop.PaintPicture pic, X, Y, pic.Width, pic.Height

This paints the icon onto the form...If you want a background picture (unless I misunderstood the question-which is likely) then you will need to paint the background picture on the form or use the picture property to set it as the forms background...
0
lpetrowiczAuthor Commented:
justchat 1,

Ok, I feel like an idiot but I am still confused.  Here is clearly what I am looking for.  I have the picture of a car (car.jpg).  I want this picture to be on Form1 and add a couple of graphic pictures (graphic1.jpg, graphic2.jpg) to be able to drag and drop on that car picture.  I also want to be able to drag and drop the same graphic picture numerous times if I would like.  Please, what exactly should my code look like (EXACTLY!!!!, PLEASE!!!!)??
0
justchat_1Commented:
move a graphic onto the form and then move it around? or just move multiple of the same graphics around on the form?

if you want to add images to car.jpg I would suggest starting with setting your forms .picture property to car1.jpg
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.