The image that will stay on the top must have some kind of transparency set. It is recommended that you use a BMP of 24bits. VFP will automatically convert the white parts of the image into transparent, like in the picture below, if you set the "BackStyle" property of the image object to 0 - Transparent. don't forget to set the picture to "Bring to front" in the "layout" toolbar.
The 1st form shows the 2 images separated, but with opaque backgrounds. Then, in the 2nd, I set the background to transparent, then dropped a part of the image for you to see how it is done. You can get more information in this post too:
Bmps with transparent backgrounds http://vfpimaging.blogspot.com/2007/10/bmps-with-transparent-backgrounds_881.html
Another good way is to use PNGs, that support alpha (transparencies), but the most recomended, and best supported by VFP is the use of BMPs, as shown.
Update - Oct 30, 2007
Bernard Bout remembers that "also note that all white areas of an image will become transparent. for instance in the second image in cesars post the form background is visible through the eye of the brazilian man. if this is not what you want then you must "mask" out the white parts of the bitmap that you want to be not transparent.
Just open the image and paint the white areas you want to keep black. The image should be the same size. paint all the other parts white and save it as a bmp but with a .msk extension. VFP will automatically use this file to "mask" out the white areas from being transparent."
For this case, I usually edit the image, and change the pure RGB "whites" - rgb(255,255,255) that I want to keep to another close white, such as RGB(254,254,254) nobody will notice the difference and it works very nice, with the advantage of not needing to create an extra image file.
Anyway, if you still prefer to create a mask, choose to create a 1bpp monochrome image format. Usually people save in "24bits" mode. but as msk pictures are only B&W, monochrome will bring the possibility to have the smallest image file size. Comparing to a monochrome image, the 24bpp image will be 24 times bigger in size.
In MSPAINT, for instance, choose, in "SaveAs..."
Other important notes about MSK files:
In VFP HELP for pictureval:
"You cannot specify a mask (msk) file with the pictureval property. If you are using BMP images and want a mask, you should use the picture property instead. you can also use a different image format such as gif which has transparency defined within the image."
how to: enhance control display a very nice explanation about msk files
Este articulo esta traducido al español en PortalFox:
ReplyDelete-- Cómo poner una imagen sobre otra en un formulario --
http://www.portalfox.com/article.php?sid=2548