protected override void OnVisibleChanged(EventArgs e) { base.OnVisibleChanged(e); if ((Visible && PopupAnimation == PopupAnimations.None) || (!Visible && CloseAnimation == PopupAnimations.None)) { return; } AnimationFlags flags = Visible ? AnimationFlags.Roll : AnimationFlags.Hide; PopupAnimations _flags = Visible ? PopupAnimation : CloseAnimation; if (_flags == PopupAnimations.SystemDefault) { if (SystemInformation.IsMenuAnimationEnabled) { if (SystemInformation.IsMenuFadeEnabled) { _flags = PopupAnimations.Blend; } else { _flags = PopupAnimations.Slide | (Visible ? PopupAnimations.TopToBottom : PopupAnimations.BottomToTop); } } else { _flags = PopupAnimations.None; } } if ((_flags & (PopupAnimations.Blend | PopupAnimations.Center | PopupAnimations.Roll | PopupAnimations.Slide)) == PopupAnimations.None) { return; } if (_resizableTop) // popup is “inverted”, so the animation must be { if ((_flags & PopupAnimations.BottomToTop) != PopupAnimations.None) { _flags = (_flags & ~PopupAnimations.BottomToTop) | PopupAnimations.TopToBottom; } else if ((_flags & PopupAnimations.TopToBottom) != PopupAnimations.None) { _flags = (_flags & ~PopupAnimations.TopToBottom) | PopupAnimations.BottomToTop; } } if (_resizableLeft) // popup is “inverted”, so the animation must be { if ((_flags & PopupAnimations.RightToLeft) != PopupAnimations.None) { _flags = (_flags & ~PopupAnimations.RightToLeft) | PopupAnimations.LeftToRight; } else if ((_flags & PopupAnimations.LeftToRight) != PopupAnimations.None) { _flags = (_flags & ~PopupAnimations.LeftToRight) | PopupAnimations.RightToLeft; } } flags |= (AnimationFlags.Mask & (AnimationFlags)(int)_flags); NativeUtility.AnimateWindow(this, AnimationDuration, flags); }