public void SetColor(Color color, float shadowStrength, float borderWidth, Color borderColor, float borderShadowStrength) { cleanPenAndBrush(); Color textColor = ColorUtil.GetBWColor(color); float textPenWidth = 2F; if (textFont != null) { textPenWidth = textFont.Height / 20F + 1F; } textPen = new Pen((ColorUtil.GetLuminance(textColor) > 0.5)?ColorUtil.Get("#AA000000"):ColorUtil.Get("#AAFFFFFF"), textPenWidth); textBrush = new SolidBrush(textColor); upperBrush = new SolidBrush(color); lowerBrush = new SolidBrush(ColorUtil.DarkColor(color, shadowStrength)); Color topLeftColor, bottomRightColor; if ((borderColor == ColorUtil.Auto) || (borderColor == ColorUtil.Invalid)) { topLeftColor = ColorUtil.BrightColor(color, 0.6); bottomRightColor = ColorUtil.DarkColor(color, 0.6); } else { topLeftColor = borderColor; bottomRightColor = ColorUtil.DarkColor(borderColor, borderShadowStrength); } topLeftPen = new Pen(topLeftColor, borderWidth); bottomRightPen = new Pen(bottomRightColor, borderWidth); }
/// <summary> /// 文字表示色をセットする /// </summary> public void SetTextColor(Color color) { if (textBrush != null) { textBrush.Dispose(); } textBrush = new SolidBrush(color); if (textPen != null) { Pen pen = new Pen((ColorUtil.GetLuminance(color) > 0.5)?ColorUtil.Get("#AA000000"):ColorUtil.Get("#AAFFFFFF"), textPen.Width); textPen.Dispose(); textPen = pen; } }