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. Translating pixel postion?

Translating pixel postion?

Scheduled Pinned Locked Moved C#
graphicsquestion
5 Posts 2 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.
  • D Offline
    D Offline
    Druuler
    wrote on last edited by
    #1

    So ive got a bitmap image of say size 1000*500 and use it as the background image of the form with layout property set to Stretch, now if user clicks on the form i want to be able to get the pixel postion of original image and not the x/y of the form beacuse that image is stretched? is this even possible?:confused:

    O 1 Reply Last reply
    0
    • D Druuler

      So ive got a bitmap image of say size 1000*500 and use it as the background image of the form with layout property set to Stretch, now if user clicks on the form i want to be able to get the pixel postion of original image and not the x/y of the form beacuse that image is stretched? is this even possible?:confused:

      O Offline
      O Offline
      o m n i
      wrote on last edited by
      #2

      You can't, if the image is being displayed smaller then it really is as a background, it has only has as many pixels as the form does. A pixel is a uniform size. See this if you don't get what I'm saying.

      modified on Saturday, December 19, 2009 8:46 PM

      D 1 Reply Last reply
      0
      • O o m n i

        You can't, if the image is being displayed smaller then it really is as a background, it has only has as many pixels as the form does. A pixel is a uniform size. See this if you don't get what I'm saying.

        modified on Saturday, December 19, 2009 8:46 PM

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

        I get what you are saying, but i thought we could solve this by doing some math, which i completely suck at :^) I have seen some vnc client do something similar to this, it has an option to autoscale/stretch the client view to any size but yet it can translate the current mouse location to original screen coordinates :confused:

        O 1 Reply Last reply
        0
        • D Druuler

          I get what you are saying, but i thought we could solve this by doing some math, which i completely suck at :^) I have seen some vnc client do something similar to this, it has an option to autoscale/stretch the client view to any size but yet it can translate the current mouse location to original screen coordinates :confused:

          O Offline
          O Offline
          o m n i
          wrote on last edited by
          #4

          One thing to consider would be figuring out what percentage into the image the position is horizontally and vertically and then placing the point at the same percentage in on the larger image. not 100% sure it will work but it works in my head at least.

          D 1 Reply Last reply
          0
          • O o m n i

            One thing to consider would be figuring out what percentage into the image the position is horizontally and vertically and then placing the point at the same percentage in on the larger image. not 100% sure it will work but it works in my head at least.

            D Offline
            D Offline
            Druuler
            wrote on last edited by
            #5

            I did a quick test and it wasnt able to get the exact pixel but it works much much better then my own formula,atleast im little cloesr to my goal now :) Thanks for your help :cool:

            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