2

I'm trying to create dissolve animation for a block of controls (panel). I do have a panel with few labels and few picture boxes on solid color background (lime). I'm trying to make this panel dissolve (with all labels and pictures) into the lime background. Any ideas how it could be done? I'm open to any suggestion. Thanks.

Safiron
  • 883
  • 4
  • 11
  • 30
  • Which part of this do you want help with? Do you want to get rid of the components you are dissolving away or do you just want to hide them? Is this to be something the parent object does to a child or something an object does to itself? – J... Feb 06 '13 at 13:58
  • I just want to hide all components inside the panel and the panel as well. If a panel had the Opacity property I would just create a timer to decrease the opacity value. – Safiron Feb 06 '13 at 14:09

1 Answers1

0

Sadly, there's no Opacity property in controls such as Forms.Panel. The only way that comes to mind to emulate it, is to gradually change BackColor of your controls to values that have an alpha channel set (for example using timer):

int opacity = 25;

myPanel.BackColor = Color.FromArgb(opacity, myPanel.BackColor);
myLabel.BackColor = Color.FromArgb(opacity, myLabel.BackColor);

Sadly, some controls won't react to this as expected (e.g. Button). Also, it's not so easy to change ForeColor (overriding OnPaint method of derrived controls may work in some cases)

Arie
  • 5,251
  • 2
  • 33
  • 54
  • Thanks but what if the panel has an background image ? – Safiron Feb 06 '13 at 14:21
  • Form does have Opacity property that affects its children. You can try stacking forms on top of each other, instead of using Panel, and make it "behave" like a Panel. Here is some example: http://social.msdn.microsoft.com/forums/en-US/winforms/thread/3087655c-bd50-4408-9c55-dd179e442675/ – Arie Feb 06 '13 at 14:23