Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Dragging and Dropping

Posted on 1999-07-01
Medium Priority
Last Modified: 2010-05-02
How can I drop an item onto a form when the user has dragged it. For a control such as a picture, I use picture1.drag to make the shadow of the box follow the mouse. I want to make the object stay where the user clicks the mouse. I have tried using picture1.left = X and = Y (where X and Y are the mouse pointer coordinates), but the object will move because the X and Y coordinates are never in the same place as where the x and y coordinates of the box are measured. Is there an easy command to drop the object?
Question by:mi5
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 1521271
How do you mean never the same?
Does the box seem to jump when you drop it? Or does the box appear at random somewhere on the form?
The mouse uses screen coordinaties wheras the Picture.left and top use their coordinates relative to the Form coordinates. So you would have to correct by putting:
picture1.Top = mouse.y - (form.Top -1 ) and Picture1.Left = mouse.x - (form.Left -1) (Look whether the -1 is needed in your case... )
LVL 10

Expert Comment

ID: 1521272
Delete this question, you've posted it twice!

phiro - see 

Expert Comment

ID: 1521273
See what you mean. Thanx carag_g.

Accepted Solution

VBGuru earned 100 total points
ID: 1521274
use dragicon property

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

715 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