Image Reflection in C#
Using
a combination of the Image properties and drawing graphics, you can create great
looking reflection image controls.
Create a user control and add 2 picturebox controls. Assign an image to the first
picturebox. Create a function and add the following code.
Bitmap bmp = new Bitmap(this.pictureBox1.Image);
bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
this.pictureBox2.Image = bmp;
In the PictureBox2 Paint event add the following code.
Rectangle myRectangle = new Rectangle(0,-10, this.pictureBox2.Size.Width, this.pictureBox2.Size.Height-100);
LinearGradientBrush myLinearGradientBrush = new LinearGradientBrush(myRectangle,
Color.Transparent, Color.White, LinearGradientMode.Vertical);
e.Graphics .FillRectangle(myLinearGradientBrush, myRectangle);
e.Graphics.FillRectangle(Brushes.White, 0, this.pictureBox2.Size.Height - 110, this.pictureBox2.Size.Width,
this.pictureBox2.Size.Height);
|