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 / C++ / MFC
  4. Draw a Point

Draw a Point

Scheduled Pinned Locked Moved C / C++ / MFC
question
10 Posts 4 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.
  • V Offline
    V Offline
    vivekphlp
    wrote on last edited by
    #1

    I had seen many codes that is used to draw Lines, circles etc, but i like to plot a x,y point in my screen. Can any one please tell me the function to draw a point in screen. Is it needed to convert the point to System coordinates???

    Proud To Be an Indian

    C N 2 Replies Last reply
    0
    • V vivekphlp

      I had seen many codes that is used to draw Lines, circles etc, but i like to plot a x,y point in my screen. Can any one please tell me the function to draw a point in screen. Is it needed to convert the point to System coordinates???

      Proud To Be an Indian

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      You can use the CDC::Ellipse function for that.

      vivekphlp wrote:

      Is it needed to convert the point to System coordinates???

      What do you mean by that ? What is System coordinates ? Are you drawing some kind of chart ? If yes, then of course you need to make a conversion between the point value and the position on the screen (this relation is done using the axes of your chart). You can also take a look at my sig, I developped such a chart control, so it might be usefull for you.

      Cédric Moonen Software developer
      Charting control [v1.3]

      V 1 Reply Last reply
      0
      • V vivekphlp

        I had seen many codes that is used to draw Lines, circles etc, but i like to plot a x,y point in my screen. Can any one please tell me the function to draw a point in screen. Is it needed to convert the point to System coordinates???

        Proud To Be an Indian

        N Offline
        N Offline
        Naveen
        wrote on last edited by
        #3

        SetPixel() ?

        nave [OpenedFileFinder]

        V 1 Reply Last reply
        0
        • C Cedric Moonen

          You can use the CDC::Ellipse function for that.

          vivekphlp wrote:

          Is it needed to convert the point to System coordinates???

          What do you mean by that ? What is System coordinates ? Are you drawing some kind of chart ? If yes, then of course you need to make a conversion between the point value and the position on the screen (this relation is done using the axes of your chart). You can also take a look at my sig, I developped such a chart control, so it might be usefull for you.

          Cédric Moonen Software developer
          Charting control [v1.3]

          V Offline
          V Offline
          vivekphlp
          wrote on last edited by
          #4

          I have a CPoint & would like to draw that point on my screen. How can i convert my points to system coordinates.

          Proud To Be an Indian

          C 1 Reply Last reply
          0
          • N Naveen

            SetPixel() ?

            nave [OpenedFileFinder]

            V Offline
            V Offline
            vivekphlp
            wrote on last edited by
            #5

            I think SetPixel wil change the color of the specified pixel.

            Proud To Be an Indian

            N 1 Reply Last reply
            0
            • V vivekphlp

              I have a CPoint & would like to draw that point on my screen. How can i convert my points to system coordinates.

              Proud To Be an Indian

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              Replying to my question would help a lot to answer yours :rolleyes:

              Cédric Moonen Software developer
              Charting control [v1.3]

              V 1 Reply Last reply
              0
              • V vivekphlp

                I think SetPixel wil change the color of the specified pixel.

                Proud To Be an Indian

                N Offline
                N Offline
                Naveen
                wrote on last edited by
                #7

                If the point that you want to draw have a dimension of only one pixel, then changing the color of the specified pixel( say to black color ) will make that pixel to appear as a point isnt it? if the diameter of the point you want is more than a pixel, you have to follow the way mentioned by Cedric Moonen.

                nave [OpenedFileFinder]

                1 Reply Last reply
                0
                • C Cedric Moonen

                  Replying to my question would help a lot to answer yours :rolleyes:

                  Cédric Moonen Software developer
                  Charting control [v1.3]

                  V Offline
                  V Offline
                  vivekphlp
                  wrote on last edited by
                  #8

                  I have a point say (x,y) i just want to draw it in my window.. just to see where that point is. .

                  Proud To Be an Indian

                  C C 2 Replies Last reply
                  0
                  • V vivekphlp

                    I have a point say (x,y) i just want to draw it in my window.. just to see where that point is. .

                    Proud To Be an Indian

                    C Offline
                    C Offline
                    Cedric Moonen
                    wrote on last edited by
                    #9

                    What's this conversion you're talking about then ? When you are drawing on a window, all the coordinates are relative to the upper-left corner of the client area of your window.

                    Cédric Moonen Software developer
                    Charting control [v1.3]

                    1 Reply Last reply
                    0
                    • V vivekphlp

                      I have a point say (x,y) i just want to draw it in my window.. just to see where that point is. .

                      Proud To Be an Indian

                      C Offline
                      C Offline
                      CPallini
                      wrote on last edited by
                      #10

                      If you use a window device context then pixel coords are relative to the top-left corner of that window client area. On the other hand, if you use a screen device context (for instance via GetDC(NULL)) then the pixel coords are relative to top-left corner of the screen. :)

                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

                      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