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

  • SEARCH
  • Home
  • 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 342621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:49:18+00:00 2026-05-12T10:49:18+00:00

I have the picture box in which the image may be zoomed with different

  • 0

I have the picture box in which the image may be zoomed with different values. Then I try to find out the location of cursor on picture box. I write the following code on picture box mouse move event:

int x = (2 * e.X - pictureBox1.Width + pictureBox1.Image.Width) / (2 * _scale / 100);
int y = (2 * e.Y - pictureBox1.Height + pictureBox1.Image.Height) / 2 * _scale / 100);

here _scale is is the zoomed value that may be 10,50,100,or 200 etc.

My Question:

it give the correct value if the zoomed is greater than 100%. But is the zoomed is less than 100 it give the incorrect value. How can I give the correct value if even the zoomed is less than 100% ?

Some More Explanation:

for zoomed I write the following code.

pictureBox1.Image =  new Bitmap(Orignal_image, (int)( Orignal_image .Width * scale / 100), (int)( Orignal_image.Height * scale / 100));

EDIT: The size mode of picturebox is centerImage. and it is not necessary that the picturebox width is equal to the image. its width may be less than image, and then the image show at the center of picturebox. i only need the location of image. (i.e., the 0 pixel is given by start position of image not picturebox).

  • 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-05-12T10:49:18+00:00Added an answer on May 12, 2026 at 10:49 am

    Looks like the culprit is integer division: 10 / 100 = 0

    Use float division or rearrange the expression:

    int x = (e.X - (pictureBox1.Width - pictureBox1.Image.Width) / 2) * 100 / _scale;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a picture box which reads in an image from a folder to
I have a transparent rectangle on a picture box,if i click next,the next image
I have a picture box in my application which displays pictures. Now if user
HI all, I have a picture box in my C# WinForms application which is
In vb.net i have one panel in which multiple picture box controls are added.
I want to scale captured image and show it in the picture box which
I have a picture box which I draw some stuff on it using a
Hi I am using visual studio 8, vb.net. I have a picture box on
Okay excuse the cryptic subject. I have a system which dynamically fetches image data
I am working with delphi. I have one scroll box in which I am

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.