Solved

Drag&drop-swapping

Posted on 1998-06-16
2
152 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 50 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

776 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