Exemple #1
0
        static void timer_Tick(object sender, EventArgs e)
        {
            Timer         timer   = (Timer)sender;
            AnimateMsgBox animate = (AnimateMsgBox)timer.Tag;

            switch (animate.Style)
            {
            case MessageBox.AnimateStyle.SlideDown:
                if (_msgBox.Height < animate.FormSize.Height)
                {
                    _msgBox.Height += 17;
                    _msgBox.Invalidate();
                }
                else
                {
                    _timer.Stop();
                    _timer.Dispose();
                }
                break;

            case MessageBox.AnimateStyle.FadeIn:
                if (_msgBox.Opacity < 1)
                {
                    _msgBox.Opacity += 0.1;
                    _msgBox.Invalidate();
                }
                else
                {
                    _timer.Stop();
                    _timer.Dispose();
                }
                break;

            case MessageBox.AnimateStyle.ZoomIn:
                if (_msgBox.Width > animate.FormSize.Width)
                {
                    _msgBox.Width -= 17;
                    _msgBox.Invalidate();
                }
                if (_msgBox.Height > animate.FormSize.Height)
                {
                    _msgBox.Height -= 17;
                    _msgBox.Invalidate();
                }
                break;
            }
        }