0

I have a form with 4 buttons. I would like to make the following: All of the buttons should have the same preaction. If you press any of the buttons, you make the other ones dissapear, but not just button1.Visible = false . I would like them to fade away.

Is that possible? Could you help put? I found this out for forms, but can't get my head around for buttons.

Ria
  • 10,237
  • 3
  • 33
  • 60
  • Is this Windows Forms or WPF? – Jason Nov 15 '12 at 08:40
  • Windows Forms. Sorry about that. – niksa.lovrinic Nov 15 '12 at 08:40
  • 1
    Hmm. Windows forms are definitely harder and more hackish to get something graphical like that working. WPF is made for this kind of graphic animation. Just as a side note, if you don't *need* to use Windows Forms, considering using WPF if you're into heavy graphics. – Jason Nov 15 '12 at 08:41
  • http://stackoverflow.com/questions/10178559/fade-a-panel-windows-forms. Here's a way to fade a panel (which, like a button, is just a control). If you put one button on one panel (or extend the panel as a "FadableButton" user control), you can probably hack it to work. For the four buttons having one preaction, the concept is to link all four OnClick events to one delegate. – Jason Nov 15 '12 at 08:44

2 Answers2

3

In windows forms you can fade forms changing opacity with thread sleep but forms button doesn't have that property. In addition Windows forms is not very well designed for animations and stunning visuals so I guess you will prefer WPF to perform that tasks

Check this:

Fade-in forms using .NET and C#

Carlos Landeras
  • 11,025
  • 11
  • 56
  • 82
1

Similar question with some information for development, its also suggested that you consider WPF just as Jason suggested.

Sliding & Fading controls on a C# form

Community
  • 1
  • 1
Lojko
  • 173
  • 1
  • 13