/// <summary>
        /// Animations the start.
        /// </summary>
        /// <param name="Animacion">The animacion.</param>
        /// <param name="coolEffect">if set to <c>true</c> [cool effect].</param>
        /// <param name="parametros">The parametros.</param>
        public void AnimationStart(Constantes Animacion, bool coolEffect, object[] parametros)
        {
            int            paramlength;
            FormAnimations fanims;

            fanims            = new FormAnimations(this.formappal, this.time, this.stepX, this.stepY);
            paramlength       = parametros.Length;
            formappal.Opacity = 0;
            formappal.Visible = true;

            switch (Animacion)
            {
                #region Left2Right
            ///Parameters:
            ///P[0] posini; P[1] posfin;
            ///if coolEffect is true, and paramLength < 2 the form is placed at the left side of the screen
            case Constantes.Left2Right:
                if (coolEffect && paramlength >= 2)
                {
                    formappal.Opacity = 1;
                }

                if (paramlength == 2)
                {
                    fanims.Left2Right((int)parametros[0], (int)parametros[1]);
                }
                if (paramlength == 0)
                {
                    if (!coolEffect)
                    {
                        fanims.Left2Right();
                    }
                    else
                    {
                        this.formappal.Left    = -formappal.Width;
                        this.formappal.Opacity = 1;
                        fanims.Left2Right();
                    }
                }
                if (paramlength == 1)
                {
                    if (!coolEffect)
                    {
                        fanims.Left2Right((int)parametros[0]);
                    }
                    else
                    {
                        formappal.Left         = -formappal.Width;
                        this.formappal.Opacity = 1;
                        fanims.Left2Right((int)parametros[0]);
                    }
                }
                break;
                #endregion

                #region Right2Left
            ///Parameters:
            ///P[0] posini; P[1] posfin;
            ///if coolEffect is true, and paramLength < 2 the form is placed at the right side of the screen
            case Constantes.Right2Left:
                if (coolEffect && paramlength >= 2)
                {
                    this.formappal.Opacity = 1;
                }

                if (paramlength == 2)
                {
                    fanims.Right2Left((int)parametros[0], (int)parametros[1]);
                }
                if (paramlength == 0)
                {
                    if (!coolEffect)
                    {
                        fanims.Right2Left();
                    }
                    else
                    {
                        this.formappal.Left    = Screen.PrimaryScreen.WorkingArea.Width;
                        this.formappal.Opacity = 1;
                        fanims.Right2Left();
                    }
                }
                if (paramlength == 1)
                {
                    if (!coolEffect)
                    {
                        fanims.Right2Left((int)parametros[0]);
                    }
                    else
                    {
                        formappal.Left         = Screen.PrimaryScreen.WorkingArea.Width;
                        this.formappal.Opacity = 1;
                        fanims.Right2Left((int)parametros[0]);
                    }
                }
                break;
                #endregion

                #region Top2Bottom
            ///Parameters:
            ///P[0] posini; P[1] posfin;
            ///if coolEffect is true, and paramLength < 2 the form is placed at the top side of the screen
            case Constantes.Top2Bottom:
                if (coolEffect && paramlength >= 2)
                {
                    this.formappal.Opacity = 1;
                }

                if (paramlength == 2)
                {
                    fanims.Top2Bottom((int)parametros[0], (int)parametros[1]);
                }
                if (paramlength == 0)
                {
                    if (!coolEffect)
                    {
                        fanims.Top2Bottom();
                    }
                    else
                    {
                        this.formappal.Top     = -formappal.Height;
                        this.formappal.Opacity = 1;
                        fanims.Top2Bottom();
                    }
                }
                if (paramlength == 1)
                {
                    if (!coolEffect)
                    {
                        fanims.Top2Bottom((int)parametros[0]);
                    }
                    else
                    {
                        this.formappal.Top     = -formappal.Height;
                        this.formappal.Opacity = 1;
                        fanims.Top2Bottom((int)parametros[0]);
                    }
                }
                break;
                #endregion

                #region Bottom2Top
            ///Parameters:
            ///P[0] posini; P[1] posfin;
            ///if coolEffect is true, and paramLength < 2 the form is placed at the bottom side of the screen
            case Constantes.Bottom2Top:
                if (coolEffect && paramlength >= 2)
                {
                    this.formappal.Opacity = 1;
                }

                if (paramlength == 2)
                {
                    fanims.Bottom2Top((int)parametros[0], (int)parametros[1]);
                }
                if (paramlength == 0)
                {
                    if (!coolEffect)
                    {
                        fanims.Bottom2Top();
                    }
                    else
                    {
                        this.formappal.Top     = Screen.PrimaryScreen.WorkingArea.Height;
                        this.formappal.Opacity = 1;
                        fanims.Bottom2Top();
                    }
                }
                if (paramlength == 1)
                {
                    if (!coolEffect)
                    {
                        fanims.Bottom2Top((int)parametros[0]);
                    }
                    else
                    {
                        this.formappal.Top     = Screen.PrimaryScreen.WorkingArea.Height;
                        this.formappal.Opacity = 1;
                        fanims.Bottom2Top((int)parametros[0]);
                    }
                }
                break;
                #endregion

                #region FadeIn
            ///Parameters:
            ///P[0] initial transparent percentage; P[1] opacity step;
            ///if coolEffect is not important for this animation.
            case Constantes.FadeIn:
                fanims = new FormAnimations(this.formappal, 50);
                //The time used for animations might be smaller but for a smooth FadeIn this time is good.
                if (paramlength == 2)
                {
                    formappal.Opacity = (Double.Parse(parametros[0].ToString()) + 1) / 100;
                    fanims.FadeIn(Double.Parse(parametros[0].ToString()), (int)parametros[1]);
                }
                if (paramlength == 0)
                {
                    formappal.Opacity = 0;
                    fanims.FadeIn();
                }
                break;
                #endregion

                #region FadeOut
            ///Parameters:
            ///P[0] initial transparent percentage; P[1] opacity step;
            ///if coolEffect is not important for this animation.
            case Constantes.FadeOut:
                fanims = new FormAnimations(this.formappal, 50);
                //The time used for animations might be smaller but for a smooth FadeOut this time is good.
                if (paramlength == 2)
                {
                    formappal.Opacity = (Double.Parse(parametros[0].ToString()) + 1) / 100;
                    fanims.FadeOut(Double.Parse(parametros[0].ToString()), (int)parametros[1]);
                }
                if (paramlength == 0)
                {
                    formappal.Opacity = 1;
                    fanims.FadeOut();
                }
                break;
                #endregion
            }
            this.formappal.Refresh();
        }
        /// <summary>
        /// SHKs this instance.
        /// </summary>
        private void Shk()
        {
            FormAnimations fanim = new FormAnimations(form, 15);

            fanim.ShrinkXY();
        }
        /// <summary>
        /// fs the out.
        /// </summary>
        private void FOut()
        {
            FormAnimations fanim = new FormAnimations(form, 50);

            fanim.FadeOut(101, 3);
        }
        /// <summary>
        /// Grows the v.
        /// </summary>
        private void GrowV()
        {
            FormAnimations fanim = new FormAnimations(form);

            fanim.GrowVertical(0, form.Height, false);
        }
        /// <summary>
        /// L2s the r.
        /// </summary>
        private void L2R()
        {
            FormAnimations fanim = new FormAnimations(form);

            fanim.Left2Right(0, fanim.DeterminarPos(Constantes.CenterScreen).X);
        }
        /// <summary>
        /// Starts the specified form.
        /// </summary>
        /// <param name="Form">The form.</param>
        public void Start(System.Windows.Forms.Form Form)
        {
            form = Form;
            FormAnimations formAnimation = new FormAnimations(Form, Time.Time, Time.StepX, Time.StepY);

            switch (Animation)
            {
            case FormAnimationTypes.LeftToRight:
                formAnimation.Left2Right(Positions.Start, Positions.End);
                break;

            case FormAnimationTypes.RightToLeft:
                formAnimation.Right2Left(Positions.Start, Positions.End);
                break;

            case FormAnimationTypes.TopToBottom:
                formAnimation.Top2Bottom(Positions.Start, Positions.End);
                break;

            case FormAnimationTypes.BottomToTop:
                formAnimation.Bottom2Top(Positions.Start, Positions.End);
                break;

            case FormAnimationTypes.FadeIn:
                formAnimation.FadeIn(Opacity.Start, Opacity.Step);
                break;

            case FormAnimationTypes.FadeOut:
                formAnimation.FadeOut(Opacity.Start, Opacity.Step);
                Form.Opacity = 1;
                break;

            case FormAnimationTypes.HideControls:
                FormAnimations.HideControls(Form, Time.Time, false);
                break;

            case FormAnimationTypes.ShowControls:
                FormAnimations.ShowControls(Form, Time.Time, false);
                break;

            case FormAnimationTypes.GrowHorizontal:
                formAnimation.GrowHorizontal(Grow.Start, Grow.End, Grow.FixWindowWhenGrown);
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.GrowVertical:
                formAnimation.GrowVertical(Grow.Start, Grow.End, Grow.FixWindowWhenGrown);
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.GrowXY:
                formAnimation.GrowXY(Grow.StartPoint, Grow.EndPoint, Grow.FixWindowWhenGrown);
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.ShrinkHorizontal:
                formAnimation.ShrinkHorizontal(Positions.Start, Positions.End);
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.ShrinkVertical:
                formAnimation.ShrinkVertical(Positions.Start, Positions.End);
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.ShrinkXY:
                formAnimation.ShrinkXY(Positions.StartPoint, Positions.EndPoint);
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.Move:

                if (MoveToPoint)
                {
                    formAnimation.Move(Move.RandomLocations, Move.DirectTrajectory);
                    System.Threading.Thread.Sleep(1000);
                }
                else
                {
                    formAnimation.Move(Move.StartPoint, Move.EndPoint, Move.DirectTrajectory);
                    System.Threading.Thread.Sleep(1000);
                }

                break;

            case FormAnimationTypes.GrowMoveXY:
                formAnimation.GrowMoveXY(Grow.StartPoint, Grow.Size, Grow.Recalculate);
                System.Threading.Thread.Sleep(2000);
                break;

            case FormAnimationTypes.ShrinkMoveXY:
                formAnimation.ShrinkMoveXY(Positions.StartPoint, Positions.Size, Positions.ShrinkToCenter);
                System.Threading.Thread.Sleep(2000);
                break;

            case FormAnimationTypes.Shake:

                switch (Shake.ShakeType)
                {
                case ShakeType.Horizontal:
                    formAnimation.ShakeIt(Form.Location, new Point(Form.Location.X + Shake.ShakeDistance, Form.Location.Y), Time.Time * Shake.ShakeSpeed);
                    System.Threading.Thread.Sleep(1000);
                    break;

                case ShakeType.Vertical:
                    formAnimation.ShakeIt(Form.Location, new Point(Form.Location.X, Form.Location.Y + Shake.ShakeDistance), Time.Time * Shake.ShakeSpeed);
                    System.Threading.Thread.Sleep(1000);
                    break;

                case ShakeType.Both:
                    formAnimation.ShakeIt(Time.Time * Shake.ShakeSpeed / 2);
                    System.Threading.Thread.Sleep(1000);
                    break;

                default:
                    break;
                }


                break;

            case FormAnimationTypes.ShrinkFadeOut:

                //System.Threading.Thread shakeFOutt1 = new System.Threading.Thread(new System.Threading.ThreadStart(Shk));
                //System.Threading.Thread shakeFOutt2 = new System.Threading.Thread(new System.Threading.ThreadStart(FOut));
                //shakeFOutt1.Start();
                //shakeFOutt2.Start();
                //shakeFOutt1.Join();
                //shakeFOutt2.Join();
                //System.Threading.Thread.Sleep(500);
                //Form.Opacity = 1;

                formAnimation = new FormAnimations(Form, 15);
                formAnimation.ShrinkXY();
                System.Threading.Thread.Sleep(50);
                formAnimation = new FormAnimations(Form, 50);
                formAnimation.FadeOut(101, 3);
                System.Threading.Thread.Sleep(500);
                Form.Opacity = 1;
                System.Threading.Thread.Sleep(1000);
                break;

            case FormAnimationTypes.DeterminerPosition:

                switch (Locations.FormLocations)
                {
                case FormLocations.TopLeft:
                    Form.Location = formAnimation.DeterminarPos(Constantes.TopLeft);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.TopRight:
                    Form.Location = formAnimation.DeterminarPos(Constantes.TopRight);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.BottomLeft:
                    Form.Location = formAnimation.DeterminarPos(Constantes.BottomLeft);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.BottomRight:
                    Form.Location = formAnimation.DeterminarPos(Constantes.BottomRight);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.TopCenter:
                    Form.Location = formAnimation.DeterminarPos(Constantes.TopCenter);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.BottomCenter:
                    Form.Location = formAnimation.DeterminarPos(Constantes.BottomCenter);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.LeftCenter:
                    Form.Location = formAnimation.DeterminarPos(Constantes.LeftCenter);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.RightCenter:
                    Form.Location = formAnimation.DeterminarPos(Constantes.RightCenter);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.RandomPoint:
                    Form.Location = formAnimation.DeterminarPos(Constantes.RndPoint);
                    System.Threading.Thread.Sleep(300);
                    break;

                case FormLocations.CenterScreen:
                    Form.Location = formAnimation.DeterminarPos(Constantes.CenterScreen);
                    System.Threading.Thread.Sleep(300);
                    break;
                }

                break;

            case FormAnimationTypes.LeftToRightVertical:

                //System.Threading.Thread t1 = new System.Threading.Thread(new System.Threading.ThreadStart(L2R));
                //System.Threading.Thread t2 = new System.Threading.Thread(new System.Threading.ThreadStart(GrowV));
                //t1.Start();
                //t2.Start();

                formAnimation.Left2Right(0, formAnimation.DeterminarPos(Constantes.CenterScreen).X);
                formAnimation.GrowVertical(0, form.Height, false);
                break;
            }
        }
示例#7
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     FormAnimations.SlideDown(this);
     base.OnFormClosing(e);
 }
示例#8
0
 protected override void OnLoad(EventArgs e)
 {
     FormPositioning.ScreenCenterAtTheBottom(this);
     FormAnimations.SlideUpTopMostWithoutStealingFocus(this);
     base.OnLoad(e);
 }