Is it possible for a winform to have an animation effect if it is in a parent container?

453 views Asked by At

I have a winform application using C#. I have tried everything to have a transition effect from form1 to form2.(opacity and height width change base on timer) But it seems that using parent-child container (MdiParent), it is not possible. Am I right? Or there are other way?

Here is my code..

public static System.Windows.Forms.Form gMdiForm;

public static Boolean fCheckFormNotUsed(string tMdiChildFormName)
    {
        foreach (System.Windows.Forms.Form childform in gMdiForm.MdiChildren)
        {
            if (childform.Name == tMdiChildFormName)
            {
                childform.Visible = true;
                childform.Activate();
                return false;
            }
        }
        return true;
    }

if (fCheckFormNotUsed("frm2"))
        {
            frm2 mMDIChild = new frm2();
            mMDIChild.MdiParent = cls0G.gMdiForm;
            mMDIChild.WindowState = FormWindowState.Maximized;
            mMDIChild.Opacity = 0;
            mMDIChild.Show();

        }

Here is the code for timer in frm2

private void timer1_Tick(object sender, EventArgs e)
    {
        if (this.Opacity <= 1.0)
        {
            this.Opacity += 0.07;
            this.Height += 1;
            this.Width  += 3;

        }
        else
        {
            timer1.Stop();
        }
    }

Here is the load for form2

        this.Opacity = 0;
        timer1.Start();
0

There are 0 answers