示例#1
0
        /// <summary>
        /// 更新 状态信息展示栏和状态颜色 方法
        /// </summary>
        /// <param name="statusColor"></param>
        /// <param name="message"></param>
        private void ShowStatusMessageAndColor(ReturnMessage result)
        {
            Color target;

            //根据调用结果成功与否决定状态信息颜色  红绿两种
            if (result.CallStatus)
            {
                target = Color.YellowGreen;
            }
            else
            {
                target = Color.Maroon;
            }

            if (!IsShowMessageBussy)
            {
                IsShowMessageBussy = true;

                //显示信息
                this.metroLabStatusMsg.Text = result.CallMessage;

                MetroFramework.Animation.ColorBlendAnimation myColorAnim = new MetroFramework.Animation.ColorBlendAnimation();
                myColorAnim.Start(this.panelStatusColor, "BackColor", target, 2);
                myColorAnim.AnimationCompleted += new EventHandler(myColorAnim_AnimationCompleted);
            }
        }
 public static void UpdatePanelColor(Panel panel, Color c, int duration = 30)
 {
     try
     {
         Panel b = (Panel)panel;
         b.ForeColor = Color.White;
         MetroFramework.Animation.ColorBlendAnimation Animation
             = new MetroFramework.Animation.ColorBlendAnimation();
         Animation.Start(b, "BackColor", c, duration);
     }
     catch (Exception)
     {
     }
 }
 public static void UpdateColor(Panel panel, Color c, int duration = 30)
 {
     foreach (Control item in panel.Controls)
     {
         if (item is Button)
         {
             try
             {
                 Button b = (Button)item;
                 b.ForeColor = Color.White;
                 MetroFramework.Animation.ColorBlendAnimation Animation
                     = new MetroFramework.Animation.ColorBlendAnimation();
                 Animation.Start(b, "BackColor", c, duration);
             }
             catch (Exception)
             {
             }
         }
     }
 }
示例#4
0
        private void metroButton4_Click(object sender, EventArgs e)
        {
            Color target = Color.Purple;

            if (steps == 1)
            {
                target = Color.RoyalBlue;
            }
            if (steps == 2)
            {
                target = Color.YellowGreen;
                steps  = -1;
            }

            steps++;

            MetroFramework.Animation.ColorBlendAnimation myColorAnim = new MetroFramework.Animation.ColorBlendAnimation();
            myColorAnim.Start(panel1, "BackColor", target, 1);
            myColorAnim.AnimationCompleted += new EventHandler(myColorAnim_AnimationCompleted);

            metroButton4.Enabled = false;
        }