I would like to have an image of europe in a TForm or TPanel where each country can simulate the functionality of a button. I would also like to be able to change the colour of each country dynamicaly.
Does anyone know if this is possible to do in C++ Builder? Any examples or hel开发者_Python百科p much appreciated.
Thanks
It is possible.
One quick solution assuming that your image is NOT scaled. Have a second image similar with the Europe map where each country will have a unique color. At OnMouseMove of the panel where the image is read the position in regard with Europe map (the image) and get the value of the pixel on the other image - using Timage->Picture->Bitmap->Canvas->Pixels[x][y], so you will get the country or any other info you maybe set. Using the same method you can tell what pixels are regarding to a country and do a replacement. This is a quick workaround, there are MANY other ways possible, like overlays of images (multiple TImage controls).
精彩评论