Eto macOS - Eto.Forms.ImageListItem issue

problems 3 Eto.Forms.ImageListItem


DropDown dd = new DropDown() { ID = Guid.NewGuid().ToString(), };
            int sizz = 40;
            DA.GetData(6, ref sizz);

            foreach (string opt in opts)
            {
                System.Drawing.Bitmap original = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(opt);
                System.Drawing.Bitmap resized = new System.Drawing.Bitmap(original, new System.Drawing.Size(sizz, sizz));

                System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
                byte[] bb = (byte[])converter.ConvertTo(resized, typeof(byte[]));
                Image image = new Bitmap(bb);

                var item = new ImageListItem();
                item.Image = image;
                item.Text = Path.GetFileNameWithoutExtension(opt);
                // Add the item to the DropDown list
                dd.Items.Add(item);
            }

I’m having trouble getting the Image. :thinking:

Hi @taraskydon,

Can you provide code to a working sample, that we can run here, that demonstrates the issue?

Thanks,

– Dale

The problem here was these examples. replacing them with Rhino.UI.EtoExtensions.ToEto helped to load the image. it’s a macOS problem.

// System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
// byte[] bb = (byte[])converter.ConvertTo(resized, typeof(byte[]));

 Bitmap rImage = Rhino.UI.EtoExtensions.ToEto(resized);

examples
Uploading: ToolPanel.zip…
ToolPanelTESTui.rhp (207 KB)