-3

我有 2 Panels。两个面板都加载给定的时间。现在我想在两个面板上添加一些动画

// animation start of panel1
panel1.show();

// animation start of panel2
panel2.show();

完成panel1动画后,第二个面板动画开始。Soo 现在我想同时为两个面板设置动画。

我认为多线程可以做到这一点。你能告诉我这在我的情况下如何工作吗?

public static class Util { 
    public enum Effect { Roll, Slide, Center, Blend } 
    public static void Animate(Control ctl, Effect effect, int msec, int angle) 
    { 
         int flags = effmap[(int)effect]; 
         if (ctl.Visible) {flags |= 0x10000; angle += 180;} 
         else { 
              if (ctl.TopLevelControl == ctl) flags |= 0x20000; 
              else if (effect == Effect.Blend) throw new ArgumentException(); 
         } 
         flags |= dirmap[(angle % 360) / 45]; 
         bool ok = AnimateWindow(ctl.Handle, msec, flags); 
         if (!ok) throw new Exception("Animation failed"); 
         ctl.Visible = !ctl.Visible; 
     } 

     private static int[] dirmap = { 1, 5, 4, 6, 2, 10, 8, 9 }; 
     private static int[] effmap = { 0, 0x40000, 0x10, 0x80000 }; 

     [DllImport("user32.dll")] private static extern bool 
        AnimateWindow(IntPtr handle, int msec, int flags); 
} 

private void Form1_Load(object sender, EventArgs e) { 
     Util.Animate(radPanel1, Util.Effect.Slide, 700, 360); 
     radPanel1.Show(); 
     expandablePanel1.Expanded = true;
} 
4

1 回答 1

-2

我建议使用BackgroundWorkerTimer组件。

于 2013-02-27T14:50:46.597 回答