0

Is it possible to perform this CSS animation effect in a Button or Panel - WindowsForms C#?

The question is not duplicated, I want to achieve that animation specifically, in the question that has been placed as a possible duplicate does not realize this animation.

enter image description here

I tried like this, but in this way it only takes the solid color without the animation:

private void button1_MouseDown(object sender, MouseEventArgs e)
{
    button1.BackColor = Color.LightGray;
}

private void button1_MouseEnter(object sender, EventArgs e)
{
    button1.BackColor = Color.Crimson;
}

private void button1_MouseLeave(object sender, EventArgs e)
{
    button1.BackColor = Color.Transparent;
}

private void button1_MouseUp(object sender, MouseEventArgs e)
{
     button1.BackColor = Color.Crimson;
}

I have tried placing Gif Images but the gifs do not play when I run the application, the still image without animation is shown.

Is it possible to realize this effect?

Environment: Visual Studio & .NET Netframework 4

Without image advertising, gif created with a software trial version.

J. Rodríguez
  • 256
  • 1
  • 6
  • 21
  • Not is duplicate :( – J. Rodríguez Jan 16 '18 at 22:54
  • 2
    These questions+answers seem closer to what you want: [Animated Glow Effect for Button - C# Windows Forms](https://stackoverflow.com/q/39020262) and [How to create button animation similar in calculator with C#](https://stackoverflow.com/q/12758015) and [Create Animated Button](https://stackoverflow.com/q/8176212). In all cases the answer seems to be, *In [tag:winforms] you have to do it manually with a timer*. So I'm going to suggest that, rather than re-opening this question as-is, you give it a try and ask a more specific question if you get stuck. – dbc Jan 17 '18 at 02:36
  • I did find this however: [GIF Animation not working in Windows Form](https://stackoverflow.com/q/9905493). – dbc Jan 17 '18 at 02:37
  • Thanks, All the links you have sent are fine, but I do not know how to paint on the button to make that animation as the image that went up, that moves downwards as that effect – J. Rodríguez Jan 17 '18 at 02:41
  • 2
    Then, rather than a duplicate, this question may be too broad. If you're asking us to code the entire thing for you from scratch, you're unlikely to get an answer. I'm still going to suggest you try following the linked answers and articles (e.g. https://www.codeproject.com/Articles/263093/Animate-Properties-in-Windows-forms) and ask more specific questions, as needed, e.g. about how to do the incremental blending. – dbc Jan 17 '18 at 03:09
  • No problem. Sorry I couldn't find an easy answer for you. – dbc Jan 17 '18 at 03:11

0 Answers0