Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8825333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:51:11+00:00 2026-06-14T06:51:11+00:00

In a program I’m writing, I need the position of the mouse absolute to

  • 0

In a program I’m writing, I need the position of the mouse absolute to the left upper corner of the form.
I’m using this code:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Debug.Print "x: " & X & " - y: " & Y

End Sub

When I use this code, the upper left corner has coordinates 0,0. But the problem is that the values are 15 times too big when I move inside the form.

So that’s why I used:

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    Debug.Print "x: " & X / 15 & " - y: " & Y / 15

End Sub

This gives the correct coordinates, but why do I need to devide this by 15?
I’m not sure if this code will be compatible on other systems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:51:12+00:00Added an answer on June 14, 2026 at 6:51 am

    Looking at the documentation for MouseMove. The X and Y values returned correspond to the “ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties of the object.”

    Therefore looking at the documentation for ScaleHeight, ScaleWidth and for ScaleLeft, ScaleTop, it is clear that you can dictate how the X and Y coordinates are determined. You are not limited to Twips or Pixels, but can use whatever numbering system you dictate.

    Here’s a quote from the ScaleHeight, ScaleWidth page:

    For example, the statement ScaleHeight = 100 changes the units of
    measure of the actual interior height of the form. Instead of the
    height being n current units (twips, pixels, …), the height will be
    100 user-defined units. Therefore, a distance of 50 units is half the
    height/width of the object, and a distance of 101 units will be off
    the object by 1 unit.

    In this regard to assure your results match your expectation, you can tell the form exactly how many user-defined units it contains.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Program Details: I am writing a program for python that will need to look
Program that calculates and shows the value of (2 to the 10th power) This
This program builds a dictionary out of a list based on what two index
This program returns: package main import ( flag fmt ) func main() { num_agents
This program runs just fine, but for some reason when I ask for an
/*Program to merge to arrays using pointers in descending order, when the first array
This program so far has one purpose, take in two integers(the size of the
Program I'm making has a simple configuration file looking something like this. @overlays =
Program crashes when set location coordinates using MKMapView. Log: Terminating app due to uncaught
This program has the user input name / age pairs and then outputs them,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.