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 3957100
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:26:53+00:00 2026-05-20T02:26:53+00:00

Hi am looking for some help I have a Diagonal line drawn on a

  • 0

Hi am looking for some help

I have a Diagonal line drawn on a picture box on my forum and i need to know if the user has clicked the line

I have the Start point and End Point of the Line and the mouse x,y location

So i basically need to find out if the x,y of the mouse is on the line.

can anyone help?

Thanks

  • 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-20T02:26:54+00:00Added an answer on May 20, 2026 at 2:26 am

    Example: Line Start point (A) is (0, 0), END point (B) is (10, 5).
    Slope of line is therefore:

    m(slope) = (y2 - y1) / (x2 - x1) 
             = (5 - 0) / (10 - 0)
             = 5 / 10
             = 0.5
    

    To check if your point(x,y) (C) is on the line it must have the same slope from A->C and C->B. so do the same calculation again. Say point is (4, 2)

    m(AC) = (2 - 0) / (4 - 0)
          = 2 / 4
          = 0.5
    
    m(CB) = (5 - 2) / (10 - 4)
          = 3 / 6
          = 0.5
    

    Therefore this point would be on line AB.

    If point was (20, 10)

    m(AC) = (10 - 0) / (20 - 0)
          = 10 / 20
          = 0.5
    

    However:

    m(CB) = (5 - 10) / (10 - 20)
          = -5 / -10
          = -0.5
    

    Similarly if point was (2, 2)

    m(AC) = (2 - 0) / (2 - 0)
          = 2 / 2
          = 1
    
    m(CB) = (5 - 2) / (10 - 2)
          = 3 / 8
          = 0.375
    

    So for a point to be on a line m(AB) == m(AC) == m(CB)

    You may have a bit of work arounds to perform as you may not be able to get decimal values, and your line may be more than one pixel in width, but these basic principles should see you through.

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

Sidebar

Related Questions

looking for some help with images referenced within the stylesheet. I have no problems
Looking for some help! I need to split a string at the last occurrence
I need some help. I am looking for a regex that would match the
I am looking for some help. I have found this script that sort of
I am looking for some help with a MYSQL query. I have two tables,
Im looking for some help on information on files using Power shell, we have
I'm looking for some help. I've tried searching this site and have tried amending
I am once again looking for some help. I have found this stopwords script
As title says. I am looking for some help with my .htaccess. I have
I'm looking for some help with an XSL selector: What I need is a

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.