using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Uni_Trend.MSO7000X.Common.Helper
{
public static class ColorHelper
{
///
/// 混合两个颜色,主要是用于控件禁用后颜色的修改
///
///
///
///
///
public static Color MixColor(this Color cA, Color cB, int pA = 20)
{
decimal percentA = 1 - (decimal)pA / 100;
decimal R = cA.R - (cA.R - cB.R) * percentA;
decimal G = cA.G - (cA.G - cB.G) * percentA;
decimal B = cA.B - (cA.B - cB.B) * percentA;
return Color.FromArgb((int)R, (int)G, (int)B);
}
///
/// 根据当前颜色创建控件禁用颜色
///
///
///
///
public static Color MixColor(this Color cA, int pA = 20)
{
Color cB = Color.Gray;
decimal percentA = 1 - (decimal)pA / 100;
decimal R = cA.R - (cA.R - cB.R) * percentA;
decimal G = cA.G - (cA.G - cB.G) * percentA;
decimal B = cA.B - (cA.B - cB.B) * percentA;
return Color.FromArgb((int)R, (int)G, (int)B);
}
}
}