Glossary Item Box
A common, yet powerful use of ImgX is to overlay one image on top of another. This can be done behind the scenes with no user interaction, or with user interaction allowing the top image to dragged over the bottom image, then when complete, actually merging the images. This topic discusses both. If you do not need user interaction, skip to Overlaying the Image.
The simplest and most effective way to float one image on top of another is to use two ImgX Controls, one for the bottom image, and another for the top image. You will interact with the Mouse events on the top image to actually move the image based on the mouse position. The following example demonstrates how this task is accomplished. Simply drop two ImgX Controls onto your form, one for the bottom image, and another for the top image. In the Form_Load event, load the image files from a file.
This method of floating an image does not take into account alpha in the image, and does not blend it with the background. You can do this but it is a bit more difficult. Instead of using a second ImgX Control, you should use an ImgX DLL and render the image onto the bottom control's device context in the controls PaintAfter event and set the MergeAlpha parameter to true. You will notice some flashing with this method or blending the image.
Once the position of the top image has been defined relative to the bottom image, either through user interaction as in the above example or from background processing, the top image can be merged with the bottom image. ImgX has three methods for overlaying images:
© 2000-2005 Atalasoft, Inc.