Results 1 to 4 of 4

Thread: [RESOLVED] Dynamic coordinates for an image in picturebox.

  1. #1

    Thread Starter
    Member blueorange's Avatar
    Join Date
    Sep 2008
    Location
    Philippines
    Posts
    47

    Resolved [RESOLVED] Dynamic coordinates for an image in picturebox.

    I have an image loaded to a picture box control, a map of the world for example and I want the user to be able to click any country and then a form will show up. I had read few posts here similar to mine and read that you can place coordinates to the countries, some sort of an image map like in html, but my problem is that my picture box is in the MDI child and the parent form and its child are resizable so that it will match to any monitor screen. If a user resizes the form, the picture box also automatically resizes at aspect ratio, how do I automatically adjust the coordinates? Also, the map can be zoom in the picture box and i need it also to adjust its coordinates.

    Some also say that i can check which which country is been clicked based on the color of the picture where the mouse was clicked at? Is this true? does anyone have a sample code to do this? Each country in the map had unique color and perhaps this one is easier to implement because perhaps it won't be affected whether the form was resized to maximize size or just in its minimal size. Does anybody had a code and tried this? Also, is it possible, that i can change the color of some parts of an image in a picture box, for example, when I hover a country, the color of that country becomes blue while the other countries just retain their respective color?

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Dynamic coordinates for an image in picturebox.

    Try this simple example.

    EDIT: There is an error in the code for one of the counties.
    Code:
      '
      '
      '
       Case 1677088 '<----- wrong value; use RGB(128, 255, 255) instead
         County = "Evenbourghs"
      '
      '
      '
    Also, I have another one that use HTML image map but since you are going to resize your map it won't do you any good because HTML image maps are for fixed sizes unles you want to figure out how to re-evaluate the mape cooridinates which I don't have the time to work out now.
    Attached Files Attached Files
    Last edited by jmsrickland; Dec 18th, 2008 at 01:20 PM.

  3. #3
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: Dynamic coordinates for an image in picturebox.

    Search the forum for the GetPixel API.
    It will get the color for you.

  4. #4

    Thread Starter
    Member blueorange's Avatar
    Join Date
    Sep 2008
    Location
    Philippines
    Posts
    47

    Re: Dynamic coordinates for an image in picturebox.

    Exactly what I'm looking, thanks jmsrickland and longwolf. I rated you both.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width