private static Bitmap GetBitmapFromEmbededResource(string resourceId) { var png = new ThemedIconResource(resourceId, "Tangerine").GetResourceStream(); if (png == null) { throw new ArgumentException($"Icon '{resourceId}' doesn't exist"); } return(new Bitmap(png)); }
private static Icon CreateIcon(string id, string defaultId = null) { while (true) { var png = new ThemedIconResource(id, "Tangerine").GetResourceStream(); if (png != null) { return(new Icon(new Bitmap(png))); } id = defaultId ?? throw new ArgumentException($"Icon '{id}' doesn't exist"); defaultId = null; } }
private static Icon CreateIcon(string id, string defaultId = null) { while (true) { foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { try { var png = new ThemedIconResource(id, assembly.GetName().Name).GetResourceStream(); if (png != null) { return(new Icon(new Bitmap(png))); } } catch (System.Exception) { } } id = defaultId ?? throw new ArgumentException($"Icon '{id}' doesn't exist"); defaultId = null; } }