Лежит на форме picture box. нужно чтоб картика плавно появлялась и тут же плавно исчезала... Как можно такое сделать без анимированного Gif? Winforms.
string fileName = @"D:\Picture.jpg";
Graphics gra;
float counter = 0.01f;
Bitmap image;
private void Form1_Load(object sender, EventArgs e)
{
image = new Bitmap(fileName);
pictureBox1.Image = new Bitmap(fileName);
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
counter += 0.01f;
pictureBox1.Refresh();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
if (counter > 1)
{
timer1.Stop();
counter = 0;
return;
}
gra = e.Graphics;
gra.Clear(SystemColors.Control);
ColorMatrix cm = new ColorMatrix();
cm.Matrix00 = cm.Matrix11 = cm.Matrix22 = cm.Matrix44 = 1;
cm.Matrix33 = counter;
ImageAttributes ia = new ImageAttributes();
ia.SetColorMatrix(cm);
gra.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, ia);
}