我给普通窗体添加一些渐显的特效。但是把他设置为子窗体的时候特效就没有了。求解。。该如何做。

解决方案 »

  1.   

     #region 渐变
            [System.Runtime.InteropServices.DllImport("user32")]
            private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
            private const int AW_HIDE = 0x10000;
            private const int AW_SLIDE = 0x40000;
            private const int AW_BLEND = 0x80000;//透明渐变显示        private void FrmCote_Load(object sender, EventArgs e)
            {
                AnimateWindow(Handle, 1000, AW_BLEND);
            }
            private void FrmCote_FormClosing(object sender, FormClosingEventArgs e)
            {
                AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | AW_BLEND);
            }
            private void btnClose_Click(object sender, EventArgs e)
            {
                this.Close();
            }
            #endregion这是一个窗体里的效果。。
    父窗体里用
    FrmcCote f = new FrmcCote();
    f.MdiParent = this;
                f.Show();
    来把那个窗体添加为父窗体的子窗体的话就没效果了
      

  2.   

    Closing 的时候 加一句 this.MdiParent = null; 可以得到你要的效果
      

  3.   

    SHow的时候,FrmcCote f = new FrmcCote();  f.Show();
    f.MdiParent = this; //后写效果不是很好,要调整调整其它效果
      

  4.   

    private void FrmCote_FormClosing(object sender, FormClosingEventArgs e)
      {
       this.MdiParent = null; 
      AnimateWindow(this.Handle, 1000, AW_SLIDE | AW_HIDE | AW_BLEND);
      }总之MDI里面用特效比较麻烦