Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How can I compare two points in C#?

How can I compare two points in C#?

Scheduled Pinned Locked Moved C#
questioncsharptutorial
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kmuthuk
    wrote on last edited by
    #1

    Hi How can I compare two points in c#? For example, Point p1 = new Point(0, 0); Point p2 = new Point(20, 20); How do I p1 < p2 or p2 < p1? I know p1.equals(p2) to check whether both are equal. But how do I do <, >? Thanks in advance Muthu.

    C D L 3 Replies Last reply
    0
    • K kmuthuk

      Hi How can I compare two points in c#? For example, Point p1 = new Point(0, 0); Point p2 = new Point(20, 20); How do I p1 < p2 or p2 < p1? I know p1.equals(p2) to check whether both are equal. But how do I do <, >? Thanks in advance Muthu.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      How do YOU define if a two-dimentional coordinate is less that (or greater than) another two-dimentional coordinate?


      Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

      K 1 Reply Last reply
      0
      • K kmuthuk

        Hi How can I compare two points in c#? For example, Point p1 = new Point(0, 0); Point p2 = new Point(20, 20); How do I p1 < p2 or p2 < p1? I know p1.equals(p2) to check whether both are equal. But how do I do <, >? Thanks in advance Muthu.

        D Offline
        D Offline
        davidc2p
        wrote on last edited by
        #3

        The only thing you can really do is defining which is below or upper and left or right to the other. Is that what you want? The notion of comparing 2 points defined by 2 dimensions coordinates is inappropriate in the context.

        David Domingues at webrickco@gmail.com. Feel free to visit http://webrick.athost.net/index.php

        1 Reply Last reply
        0
        • C Colin Angus Mackay

          How do YOU define if a two-dimentional coordinate is less that (or greater than) another two-dimentional coordinate?


          Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

          K Offline
          K Offline
          kmuthuk
          wrote on last edited by
          #4

          Basically, I have a panel in my form, and I want to capture whether my mouse is out of panel or inside panel. I dont want to use mouse_leave and mouse_enter. so, when I capture panel's top-left and bottom-right I need to compare it with mouse pointer's coordination. hope i explained clearly. Thanks Muthu.

          W 1 Reply Last reply
          0
          • K kmuthuk

            Basically, I have a panel in my form, and I want to capture whether my mouse is out of panel or inside panel. I dont want to use mouse_leave and mouse_enter. so, when I capture panel's top-left and bottom-right I need to compare it with mouse pointer's coordination. hope i explained clearly. Thanks Muthu.

            W Offline
            W Offline
            wout de zeeuw
            wrote on last edited by
            #5

            What's wrong with comparing the x and y coordinates of the points?

            Wout

            1 Reply Last reply
            0
            • K kmuthuk

              Hi How can I compare two points in c#? For example, Point p1 = new Point(0, 0); Point p2 = new Point(20, 20); How do I p1 < p2 or p2 < p1? I know p1.equals(p2) to check whether both are equal. But how do I do <, >? Thanks in advance Muthu.

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              is a point inside some rectangle ? such a popular question must have a very simple answer: bool Control.Bounds.Contains(Point) :)

              Luc Pattyn

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups