Eto.Forms.Label ignore BackgroundColor

I have a colorDict, whose <key,value> pairs are number and associated System.Drawing.Color.

When I try to set these color onto a Eto.Forms.Label.BackgroundColor, contained in an EtoCollapsibleSection, contained in an Eto.Forms.Panel, the color is simply grey.

Afaik, this problem is similar to this and this.

I tried to use RhinoLayout.DisablePanelColorStyling(this), but the function is set at internal in the source code.

Currently running Rhino 7.25.

Cheers.

I’ll post the solution here for anyone interested, this isn’t a good solution, but you can use ColorPicker instead of Label.

                //Label colorLabel = new Label(); //This doesn't work, cause Rhino apply default styling onto label -> Deletting user-defined color
                ColorPicker colorLabel = new ColorPicker();
                colorLabel.Value = Eto.Drawing.Color.FromArgb(
                    sysColor.R,
                    sysColor.G,
                    sysColor.B,
                    sysColor.A);

Hi, @Nghia Try:

      this.Styles.Add<Label>(null, c =>
      {
        c.TextColor = Colors.Blue;
        c.BackgroundColor = Colors.Green;
      });

It will cover all the control styles called Label in the container. Similarly, it is the same with other controls. You can set the style under Layout, such as: layout.Styles<Label>(null, c=>() {/***style***/});
–Easy

1 Like

This method is not applicable for me, as the colors are calculated dynamically (using a color mapping)

Thanks tho.