Ejemplo n.º 1
0
        private static void DrawColorDragButton(DrawingContext dc, StyleRuleSet ruleSet, Rect buttonRect, int id, char colorChar, double value, GUIState state)
        {
            dc.DrawRectangle(new Brush(new Color(0.80f, 0.80f, 0.80f, 0.30f)), null, buttonRect);

            string text         = string.Format("{0}:{1,3}", colorChar, (int)(value * 255));
            var    fullTextSize = ruleSet.CalcContentBoxSize(text, state);

            if (fullTextSize.Width > buttonRect.Width)
            {
                text = ((int)(value * 255)).ToString();
            }

            dc.DrawBoxModel(text, ruleSet, buttonRect);
        }