1

I have the code to make the form partially transparent when is being moved, but I want to know if it's possible to add fade-in and fade-out effects when I start moving and stop moving the form.

EDIT

The code I am using to add transparency to the form is:

        bool canMove = false;

    private void Form1_Load(object sender, EventArgs e)
    {
        canMove = true;
    }

    private void Form1_Move(object sender, EventArgs e)
    {
        if (canMove)
        {
            this.Opacity = 0.7;
        }
    }

    private void Form1_ResizeEnd(object sender, EventArgs e)
    {
        this.Opacity = 1;
    }
jonsca
  • 10,218
  • 26
  • 54
  • 62
Alan
  • 87
  • 1
  • 1
  • 5

2 Answers2

0

You could take a Timer control, you could then start the timer when form starts moving and set the transparency of the form to some value, and on each tick of the Timer, make the transparency to decrease and on some value make it to increase. If you want to have the fadein fadeout effect when form stops moving, you can do the same when the form has moved.

FIre Panda
  • 6,537
  • 2
  • 25
  • 38
0

You should use a Timer control, set the opacity in timer's tick event. until the form stops moving (define a variable like isMoving and set it to true/false based on form's status).

You can find an example of setting opacity in timer's tick event in my article about a fading label. Use Google translator to read it.

Hope this helps.

Kamyar
  • 18,639
  • 9
  • 97
  • 171