Hi - I just noticed that Eto Forms text labels ignore text color and background color in Rhino 7. The UI looks fine in Rhino 6. I am on Windows and work on a compiled C# project.
Any idea what this could be about?
Colors are set in the constructor as follows:
var theLabel = new Label
{
Text = “-”,
Font = font,
TextColor = text_color,
TextAlignment = TextAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Height = 45,
Width = 70,
BackgroundColor = Color.FromArgb(31, 107, 196, 80),
Wrap = WrapMode.None
};
@curtisw, any insight on this? The R7 Eto labels are rendering with a grey background, regardless of the BackgroundColor of the control (or its parent). Is this something that can be fixed?
You can try using a Rhino.UI.Controls.StaticAlignedLabel control, it is essentially just a label that the default styling ignores. I don’t recall if I check for that in the panel styler. I have a trick for identifying things to ignore in the panel styler but it is not publicly exposed right now. I can make a public way to do it if it is an issue.
The default label style left justifies label text on Windows and right justifies it on Mac. The panel styler should only affect colors if the label is embedded in a panel.
Now that I think about this, if your label is in a Rhino tabbed panel you should be able to apply your own style to control the text and background colors, the Rhino style should not get applied if the control has a style override.
@JohnM the labels are in a dockable panel that integrates with the tabs like properties and layers etc. The text justification is not affected. Center justified text still is centered. Text color and Background color are ignored/overridden.
Did you try changing the colors in a style on your labels? The panel system creates a host Eto Panel and applies a style to the host. The style includes syncing label text and background colors. The style should get ignored if a control has a specific style associated with it.
Just seeing this now – must’ve missed a notification. Thanks for the feedback, @JohnM. To confirm Timur’s finding, I tried both the StaticAlignedLabel and applying styles. In both cases the TextColor and BackgroundColor parameters are ignored (text renders black, background grey, no matter what).
code:
result:
This occurs if and only if the control is part of a Rhino panel. As part of a Window or anything else, the colors render correctly.
Any other ideas for a workaround? Otherwise a fix would be great.
The top and bottom labels are styled using the default host style/colors, the middle two use custom styles provided by the runtime panel and control the text and background colors.
I’ve run into the exact same problem with the label Styling. I’ve tried setting the styles in the Panel itself, however the children are created separately because they are nested within several different layouts. To get the style I use