Example #1
0
        private void ctTimer_Tick(object sender, EventArgs e)
        {
            if (_previousColor == null)
            {
                _previousColor = ctLogo.BackColor;
            }

            if (_targetColor != null)
            {
                if (_countdown == 0)
                {
                    _previousColor = ctLogo.BackColor = _targetColor.Value;
                    _targetColor   = null;
                    _countdown     = 60;
                }
                else
                {
                    ctLogo.BackColor = GraphicsUtil.ColorBlend(_targetColor.Value, _previousColor.Value, (60 - _countdown) / 60d);
                    _countdown--;
                }
            }
            else
            {
                _countdown--;
                if (_countdown == 0)
                {
                    _countdown   = 60;
                    _targetColor = Color.FromArgb(Rnd.Next(0, 255), Rnd.Next(0, 255), Rnd.Next(0, 255));
                }
            }
        }