473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to drag an Image

Hello everybody
I would like to know how to drag an image using mouse and drop it somewhere else in the same form. Can anyone help me.
Dec 19 '06 #1
5 2119
aaryan
82
Hello everybody
I would like to know how to drag an image using mouse and drop it somewhere else in the same form. Can anyone help me.
Kishore,
after doing it yourself, you will find how easy a task it is. well all you have to do is left click your mouse and you'll find that the image is selected. now hold on the mouse like that without releasing it and drag it to the desired position. now release the mouse.
i hope i'm clear.
Dec 20 '06 #2
Sorry, I think you didnt get my point. Let me explain you. I pasted 5 images boxes with an image in each box. Now when I Run the form, I should be able to move the images.
Dec 20 '06 #3
Killer42
8,435 Expert 8TB
Sorry, I think you didnt get my point. Let me explain you. I pasted 5 images boxes with an image in each box. Now when I Run the form, I should be able to move the images.
I think you may need to set the DragMode for the pictureboxes to Automatic. Then try this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
  2.   Source.Move X, Y
  3. End Sub
Dec 22 '06 #4
I think you may need to set the DragMode for the pictureboxes to Automatic. Then try this...
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
  2.   Source.Move X, Y
  3. End Sub
Thank you it works
Dec 22 '06 #5
Killer42
8,435 Expert 8TB
Thank you it works
Glad to help.

One thing to keep in mind. Using this simple technique, the picturebox is placed with its top-left corner at the cursor position. This may be acceptable depending on the cirumstances, but personally I find the result looks fairly ugly - when you drop the box, it usually jumps up and to the left.

You can get around this by tracking the position on the picturebox at which it was "grabbed" (um... in the picturebox MouseDown event, I think) and then adjusting the location accordingly when it is dropped.
Dec 23 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: portraitmaker | last post by:
I found some drag and drop code on the web and modified it a little b taking out some of the stuff I didn't need. This sample allows you to drag an image in a table to another positio and swaps...
6
by: Colin Young | last post by:
I've got a owner-drawn listview control that displays images and now I'm trying to implement drag and drop so I can drag images from the control and drop them onto other applications. So far if I...
8
by: ericgorr | last post by:
I have the following test page: http://ericgorr.net/test.html <html> <head><title>Simple JavaScript</title></head> <BODY ondragstart="alert(event.srcElement.tagName)"> <INPUT TYPE=text...
2
by: sebastian.janoschka | last post by:
Hi, I build my first Drag & Drop with JavaScript and I would like to drag the pictures when I click on it. When I create a normal div tag with some text the script works, but when I put a...
6
by: Alfonso2968 | last post by:
Hello, If someone can help plz. I have searched everything and all I can find is how to drag and drop within a form from panel to panel. What I need to do is Drag an image from the desktop...
2
by: ecashatt | last post by:
I'm a rookie trying to learn Visual Basic 2008 Express and I have created an app that includes a web browser. I need to drag and drop text and images from the browser into form controls. I currently...
0
by: jgraham | last post by:
I am trying to figure out how to receive images that are dropped from a web browser (IE or Firefox). For instance, after performing an image search on Google, I have several thumbnails displayed...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.