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

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

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

            case CustomMessageBox.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;
            }
        }
コード例 #2
0
        private void TmrAnim_Tick(object sender, EventArgs e)
        {
            AnimateMsgBox animate = (AnimateMsgBox)TmrAnim.Tag;

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

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

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