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. Graphic in C#

Graphic in C#

Scheduled Pinned Locked Moved C#
csharpgraphicsquestion
5 Posts 4 Posters 7 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.
  • U Offline
    U Offline
    User 10650102
    wrote on last edited by
    #1

    Hello, I am writing a visual C# program to read GPS coordinates (x,y) and will like to plot the points on a form as a bitmap, can someone advise me on the most effective way in doing that? Thanks, Ron

    L V B 3 Replies Last reply
    0
    • U User 10650102

      Hello, I am writing a visual C# program to read GPS coordinates (x,y) and will like to plot the points on a form as a bitmap, can someone advise me on the most effective way in doing that? Thanks, Ron

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You just need to scale the points to the coordinate system that you use in your bitmap. For example, if your bitmap is 100 x 100, and your latitude and longitude cover a range of 20 degrees each. Then each degree covers a range of 5 pixels, or alternatively each pixel is equivalent to 12 minutes. So to convert a latitude of 10'30" to pixel point, convert to minutes 10 * 60 + 30 = 630, divide by 12 = 52.5, rounded = 53. So that point lies at Y coordinate 53.

      U 1 Reply Last reply
      0
      • U User 10650102

        Hello, I am writing a visual C# program to read GPS coordinates (x,y) and will like to plot the points on a form as a bitmap, can someone advise me on the most effective way in doing that? Thanks, Ron

        V Offline
        V Offline
        V 0
        wrote on last edited by
        #3

        In addition to what Richard said if I need to draw I usually use GDI+ for simple things. You can add a panel to your form and make the background white. Then you can get a Graphics [^]object from that. You use the FromHwnd[^] method and pass the panel's handle to it. Now you can use the Graphics object to draw. Note that this also uses coordinates with 0,0 on the top left corner. The width and height of the panel are your maximum lengths to draw within the boundaries. Note that the x-axis is going to the right and the y-axis is going down! Hope this helps. (PS: there's probably a charting library available on Codeproject, you could search for that)

        V.
        (MQOTD rules and previous solutions)

        1 Reply Last reply
        0
        • U User 10650102

          Hello, I am writing a visual C# program to read GPS coordinates (x,y) and will like to plot the points on a form as a bitmap, can someone advise me on the most effective way in doing that? Thanks, Ron

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #4

          You may also take a look at my article Bernie’s Trackviewer[^]. There, the corrdinates are loaded from gpx files.

          1 Reply Last reply
          0
          • L Lost User

            You just need to scale the points to the coordinate system that you use in your bitmap. For example, if your bitmap is 100 x 100, and your latitude and longitude cover a range of 20 degrees each. Then each degree covers a range of 5 pixels, or alternatively each pixel is equivalent to 12 minutes. So to convert a latitude of 10'30" to pixel point, convert to minutes 10 * 60 + 30 = 630, divide by 12 = 52.5, rounded = 53. So that point lies at Y coordinate 53.

            U Offline
            U Offline
            User 10650102
            wrote on last edited by
            #5

            Thanks for the ideas, I'll see how this works out Ron

            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