Color display Error in Panel. Rhino 7 + Rhino 8 С#

In Rhino 7 and in Rhino 8 I have an error of color display in the Panel.

I think the problem is related to the BackgroundColor assignment in the button :face_with_monocle: (399.3 KB)
ToolPanel1.rhp (42 KB)

I think the problem is related to Rhino 7-8. and need a fix for McNeel

Hi @taraskydon,

This is a side effect of the styles we apply to panel controls, by default, so they follow the same color theme, which get applied when your panel is added to the panel host.

There is an API you can use to opt-out of this process:


which you can apply on a specific control or even the top level panel to opt out of everything.

Hope this helps,

– Dale

1 Like

I had the same issues and as off a discussion with @curtisw I used the same API code @dale suggested. There are two type of call of this method:

public static void DisablePanelColorStyling(Control etoControl, DisablePanelColorStylingProperty colorProperty)
    etoControl?.Properties.Set(DisableColorStylingKey, colorProperty, DisablePanelColorStylingProperty.None);

public static void DisablePanelColorStyling(Panel panel)
    panel?.Properties.Set(DisableColorStylingKey, DisablePanelColorStylingProperty.All, DisablePanelColorStylingProperty.None);

The second DisablePanelColorStyling(Panel panel) works fine (tested on Version 7 SR17) and applies to all subcontrols in the panel. The first DisablePanelColorStyling(Control etoControl, DisablePanelColorStylingProperty colorProperty) seems to have a bug regarding Rhino.UI.Controls.Divider. This bug is filed RH-68508 and @JohnM fixed it and will be available in the next public 7.x release.


1 Like

Oh. Thank you. I’ll wait for the update.
Maybe a fix will be added for Rhino.UI.dll 6 Rhino not to make two versions of the plugin. :upside_down_face:

The fix only applies to the Rhino.UI.Controls.Divider control. Any other control seems to work.

The buttons can be cured, but the Expander doesn’t want to be healthy. :cold_sweat:
Скриншот 2022-05-03 12
SampleCsEtoPanel.cs (2.8 KB)

Well what I did:

/// <summary>
/// Constructor
/// </summary>
public AFPanel(uint documentSerialNumber)
    this.ViewModel = new AFPanelViewModel();
    this.DataContext = this.ViewModel;

That applies to all subcontrols in the Panel.

Does that work for you? (10.8 MB)

I’m sorry, I don’t know how to fit that in. :sob:
Try in this project. show me. thank you.

using System;
using Eto.Drawing;
using Eto.Forms;
using Rhino.UI;
using Rhino.UI.Controls;
using static Rhino.UI.Controls.RhinoLayout;

namespace SampleCsEto.Views
    public class SampleCsEtoPanel2 : Panel
        ToggleButton tV1 = new ToggleButton();
        ToggleButton tL1 = new ToggleButton();
        public static System.Guid PanelId => typeof(SampleCsEtoPanel2).GUID;
        public SampleCsEtoPanel2(uint documentSerialNumber)
            DisablePanelColorStyling(this); // Try this
            Padding = 0;
            Title = GetType().Name;
            BackgroundColor = Eto.Drawing.Colors.White;

            int stL = 300;
            int stV = 40;
1 Like

Thank you !!! it cured all the components in the panel. :smiling_face_with_three_hearts: