예제 #1
0
        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);
        }
예제 #2
0
파일: MPAttribute.cs 프로젝트: mtaneda/MACS
        public Color GetColor(string name, Color defValue)
        {
            string cname = Get(name);

            if (String.IsNullOrEmpty(cname))
            {
                return(defValue);
            }
            return(ColorUtil.Get(cname, defValue));
        }
예제 #3
0
 /// <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;
     }
 }