2

Below is how I currently collapse a splitcontainer but I would like an extra effect so that when I collapse the container it should collapse slowly so that it will be feel like animation.

How can I do it this with WinForms?

private void button1_Click(object sender, EventArgs e)
{
    Thread backgroundThread = new Thread(
        new ThreadStart(() =>
        {
            if (splitContainer1.InvokeRequired)
            {
                splitContainer1.Invoke(new MethodInvoker(delegate
                {
                    splitContainer1.Panel1Collapsed = !splitContainer1.Panel1Collapsed;
                    }));
                }
            }
        ));
    backgroundThread.Start();
}
David Hall
  • 32,624
  • 10
  • 90
  • 127
Thomas
  • 33,544
  • 126
  • 357
  • 626
  • 2
    While not impossible, WinForms is not designed for animating Control objects. You could try to simulate the animation by changing the panel width/height, but this will result in all of the children redrawing each time. To really make it look good, you would want to create your own SplitContainer that can take a bitmap snapshot of its contents and animate the bitmap as it moves. If you want to create an application with fancy animation effect, WPF is better suited to the task. – Tergiver Aug 31 '12 at 16:51

0 Answers0