Exemplo n.º 1
0
        internal static void DoEffect(Control ctrl, EffectsKind kind = EffectsKind.FadeIn, bool useSlideIfPossible = true, int animationSpeedInMS = 250)
        {
            //Animate(ctrl, Effect.Slide, 150, 180);
            //return;

            int flags = 0;

            switch (kind)
            {
                case EffectsKind.SlideBottomToTop:
                    flags = WinAPI.AW_ACTIVATE | WinAPI.AW_VER_NEGATIVE;
                    if (useSlideIfPossible)
                        flags |= WinAPI.AW_SLIDE;
                    break;
                case EffectsKind.SlideTopToBottom:
                    flags = WinAPI.AW_ACTIVATE|WinAPI.AW_VER_POSITIVE;
                    if (useSlideIfPossible)
                        flags |= WinAPI.AW_SLIDE;
                    break;
                case EffectsKind.SlideLeftToRight:
                    flags = WinAPI.AW_ACTIVATE|WinAPI.AW_HOR_POSITIVE;
                    if (useSlideIfPossible)
                        flags |= WinAPI.AW_SLIDE;
                    break;
                case EffectsKind.SlideRightToLeft:
                    flags = WinAPI.AW_ACTIVATE | WinAPI.AW_HOR_NEGATIVE;
                    if (useSlideIfPossible)
                        flags |= WinAPI.AW_SLIDE;
                    break;
                case EffectsKind.Collapse:
                    flags = WinAPI.AW_ACTIVATE | WinAPI.AW_CENTER;
                    break;
                default: // EffectsKind.FadeIn
                    flags = WinAPI.AW_ACTIVATE | WinAPI.AW_BLEND;
                    break;
            }

            WinAPI.AnimateWindow(ctrl.Handle, animationSpeedInMS, flags);
        }