Пример #1
0
        /// <summary>
        /// Update form position and opacity to show/hide the window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void tmAnimation_Tick(object sender, EventArgs e)
        {
            frmPopup.painting_require = false;

            long elapsed = sw.ElapsedMilliseconds;

            posCurrent = (int)(posStart + ((posStop - posStart) * elapsed / AnimationDuration));
            bool neg = (posStop - posStart) < 0;

            if ((neg && posCurrent < posStop) ||
                (!neg && posCurrent > posStop))
            {
                posCurrent = posStop;
            }



            frmPopup.increasehight(posCurrent);
            frmPopup.Top = posCurrent;
            frmPopup.painting_require = true;

            //        System.Diagnostics.Debug.WriteLine(frmPopup.Top);


            if (elapsed > AnimationDuration)
            {
                animation_working = false;
                sw.Reset();
                tmrAnimation.Stop();
                //     System.Diagnostics.Debug.WriteLine("Animation stopped.");
            }
        }