Commit df902249 kwwwvagaa

优化按钮鼠标效果

1 个父辈 d70b2faf
......@@ -221,7 +221,7 @@ namespace HZH_Controls.Controls
if (FillColor != Color.Empty && FillColor != null)
{
m_cacheColor = this.FillColor;
this.FillColor = Color.FromArgb(230, this.FillColor);
this.FillColor = this.FillColor.ChangeColor(-0.2f);
}
}
}
......
......@@ -1442,5 +1442,48 @@ namespace HZH_Controls
// Return calculated graphics path
return graphicsPath;
}
/// <summary>
/// 颜色加深
/// </summary>
/// <param name="color"></param>
/// <param name="correctionFactor">-1.0f <= correctionFactor <= 1.0f</param>
/// <returns></returns>
public static Color ChangeColor(this Color color, float correctionFactor)
{
float red = (float)color.R;
float green = (float)color.G;
float blue = (float)color.B;
if (correctionFactor < 0)
{
correctionFactor = 1 + correctionFactor;
red *= correctionFactor;
green *= correctionFactor;
blue *= correctionFactor;
}
else
{
red = (255 - red) * correctionFactor + red;
green = (255 - green) * correctionFactor + green;
blue = (255 - blue) * correctionFactor + blue;
}
if (red < 0) red = 0;
if (red > 255) red = 255;
if (green < 0) green = 0;
if (green > 255) green = 255;
if (blue < 0) blue = 0;
if (blue > 255) blue = 255;
return Color.FromArgb(color.A, (int)red, (int)green, (int)blue);
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!