//Animates the form automatically when it is loaded. private void m_Form_Load(object sender, System.EventArgs e) { //MDI child forms do not support transparency so do not try to use the Blend method. if (this.m_Form.MdiParent == null || this.m_Method != AnimationMethod.Blend) { //Activate the form. FormAnimator.AnimateWindow(this.m_Form.Handle, this.m_Duration, (int)FormAnimator.AW_ACTIVATE | (int)this.m_Method | (int)this.m_Direction); } }
//Animates the form automatically when it closes. private void m_Form_Closing(object sender, System.ComponentModel.CancelEventArgs e) // ERROR: Handles clauses are not supported in C# { if (!e.Cancel) { //MDI child forms do not support transparency so do not try to use the Blend method. if (this.m_Form.MdiParent == null || this.m_Method != AnimationMethod.Blend) { //Hide the form. FormAnimator.AnimateWindow(this.m_Form.Handle, this.m_Duration, (int)FormAnimator.AW_HIDE | (int)this.m_Method | (int)AnimationDirection.Down); } } }
//Animates the form automatically when it is shown or hidden. private void m_Form_VisibleChanged(object sender, System.EventArgs e) // ERROR: Handles clauses are not supported in C# { //Do not attempt to animate MDI child forms while showing or hiding as they do not behave as expected. if (this.m_Form.MdiParent == null) { int flags = (int)this.m_Method | (int)this.m_Direction; if (this.m_Form.Visible) { //Activate the form. flags = flags | FormAnimator.AW_ACTIVATE; } else { //Hide the form. flags = flags | FormAnimator.AW_HIDE; } FormAnimator.AnimateWindow(this.m_Form.Handle, this.m_Duration, flags); } }