Icons for Eto Panels

I have a problem in setting icons for Eto Panels

  1. The panels with Icons work fine in Debug mode
  2. In Release the panel just does not pop up driving you crazy
System.Type panelType = typeof(MyPanel);
Rhino.UI.Panels.RegisterPanel(PlugIn.Instance, panelType, "Builder", IconManager.Instance.Icon("builder"));

/*** code to load the icon from file *******************************/
//IconManager class 

       public System.Drawing.Icon Icon( string name )
        {
           string path;
            if (mydict.TryGetValue(name, out path))
            {
                System.Drawing.Bitmap btm = new System.Drawing.Bitmap(path);
                if (btm == null) return null;
                return  System.Drawing.Icon.FromHandle(btm.GetHicon());
            }
            return null;
        }
/*******************************************************************************************/

Any hint on this ?

Hi @gerryark,

If your icon files have their “Build Action” property set to “Embedded Resource”, then you can do some as simple as this:

Panels.RegisterPanel(
  PlugIn, 
  typeof(Views.SampleCsEtoPanel), 
  "Sample", 
  Properties.Resources.SampleCsEtoPanel
);

I’ve also been known to do something like this:

var icon = Rhino.UI.DrawingUtilities.IconFromResource(
  "Test.Resources.Icon.ico", 
  GetType().Assembly
);
Panels.RegisterPanel(PlugIn, typeof(TestPanel), "Test", icon, PanelType.PerDoc);

Not sure this helps.

– Dale