Introduction
Based on an idea taken from iTunes, I was wondering if it was possible to have a nice resume image for a catalog program. On the left of the screenshot there's the original iTunes Podcast and on the other side the ImageFlip
control.
Background
This article is based on the idea to have an image control that simulate the iTunes, a shiny surface that reflects image.
The control is composed of the original image with a spectacular transparency shaded copy of itself. The control is totally transparent, so the reflected image can overlap any kind of background.
By the way, the most useful thing here is the code or the idea. So it is usable to create a bigger control with descriptions and buttons, or in a web page to dynamically create an image, maybe a PNG.
Using the code
The control usage is defined by the Image
and Divider
properties.
Image
defines the source image. An example could be an 80x80 pixel size.
Divider
defines the reflected image height, in fractions of the source image. Example: Divider
=2 means a 40 pixel reflected height.
So, the total height of the control becomes 80 + 40 = 120 pixel height.
The control is sizeable, but it does not affect in any way the image; it could be useful only to crop it. On image assignment, the control autosizes to the calculated dimensions.
Just a warning: the control is totally transparent without an image, so it's easy you can lose it in the parent form :)
Points of Interest
This is the tip found and used to set the control totally transparent:
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
History
This is a pre release and subject to improvements, if I've time to.