ToastNotifications.FormAnimator.Form_VisibleChanged C# (CSharp) Method

Form_VisibleChanged() private method

Animates the form automatically when it is shown or hidden
private Form_VisibleChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void Form_VisibleChanged(object sender, EventArgs e)
        {
            // Do not attempt to animate MDI child forms while showing or hiding as they do not behave as expected
            if (_form.MdiParent == null)
            {
                int flags = (int)_method | (int)_direction;

                if (_form.Visible)
                {
                    flags = flags | AwActivate;
                }
                else
                {
                    flags = flags | AwHide;
                }

                NativeMethods.AnimateWindow(_form.Handle, _duration, flags);
            }
        }