Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Drag&drop-swapping

Posted on 1998-06-16
2
Medium Priority
?
157 Views
Last Modified: 2010-05-03
I am using....
Private Sub Picture12_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is PictureBox Then
        Picture12.Picture = Source.Picture
    End If
End Sub
.....to drag and drop an image from one box to another.

How can I swap the images, so that the the image in the drop box is pasted into the source box?
0
Comment
Question by:PerryBond
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 150 total points
ID: 1463436
You will need a third picture box.
Set the AutoRedraw property to True.
Set the Visible property to False.

Then:
Private Sub Picture12_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is PictureBox Then
        PictureTemp.Picture = Picture12.Picture
        Picture12.Picture = Source.Picture
        Source.Picture = PictureTemp.Picture
    End If
End Sub

0
 
LVL 6

Expert Comment

by:clifABB
ID: 1463437
The above is the easy answer.

Alternately, you could use the API to create what amounts to a picturebox in memory and then use that instead.  But the above will work in most instances and, because it's visible property is set to false, it won't use much more resources than using the API calls.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question