Ejemplo n.º 1
0
        public void InitPainters()
        {
            var body = Painters[0].Add(ControlSimpleDraw.Body, "body");

            body.Value["Color", (c) => { return(Gradient ? c.AsColor().BrightColor(40) : c); }] = Property["CurrentColor"];
            body.Value["Gradient"] = Property["Gradient"];
            body.Value["Color2", (c) => { return(c.AsColor().DarkColor(10)); }] = Property["CurrentColor"];
            body.Value["Direction"]    = Property["Direction"];
            body.Value["CornerRadius"] = new Func <object>(() => { return(Value["FlatIsNow"].AsBoolean() ? 0 : CornerRadius); });

            var border = Painters[0].Add(ControlSimpleDraw.ButtonBorder, "border");

            border.Value["Color"]        = Property["CurrentColor"];
            border.Value["Down"]         = Property["Down"];
            border.Value["CornerRadius"] = Property["CornerRadius"];
            border.Value["Enabled"]      = new Func <object>(() => { return(!Value["FlatIsNow"].AsBoolean()); });

            var content = ContentRect.Painters[0].Add(BasePainters.Text, "content");

            content.Value["Text"]          = Property["Text"];
            content.Value["Font"]          = Property["Font"];
            content.Value["Alignment"]     = Property["TextAlignment"];
            content.Value["VertAlignment"] = Property["TextVertAlignment"];
            content.Value["Offset"]        = new Func <object>(() => { return(Down ? new Point(0, 1) : new Point(0, 0)); });
            content.Value["Color"]         = new Func <object>(() => { return(Enabled ? TextColor : TextColor.BrightColor(50)); });

            var focus = MarkRect.Painters[0].Add(BasePainters.Rect, "focus");

            focus.Value["Color", (c) => { return(c.AsColor().Transparent(80)); }] = Property["FocusColor"];
            focus.Value["Width"]   = 2;
            focus.Value["Enabled"] = new Func <object>(() => { return(DrawFocus && Focused && Enabled); });

            var disabled = MarkRect.Painters[0].Add(BasePainters.FillRect, "disabled");

            disabled.Value["Color"]        = Color.Silver.Transparent(80);
            disabled.Value["CornerRadius"] = Property["CornerRadius"];
            disabled.Value["Enabled"]      = new Func <object>(() => { return(!Enabled); });
        }