public void FileIcons(ImageList imageList, string findValue) { var iconList = new List <string>(); foreach (string enumValue in Enum.GetNames(typeof(enIconFileTypes))) { string ext = "." + enumValue.Replace("_", ""); if (findValue != "" && ext.Contains(findValue) == false) { continue; //<-------------[Filter } Icon icon = AssetIconTools.File_IconForExtension(ext, enIconShell32Sizes.Icon32); imageList.Images.Add(ext, icon.ToBitmap()); } }
private readonly Lamedal_WinForms _lamedWin = Lamedal_WinForms.Instance; // Load the winforms lib /// <summary> /// Creates the image from BlueprintUI resource file. /// </summary> /// <param name="resourceFile">The resource file</param> /// <param name="resourceName">The resource name</param> /// <param name="resourcePath">Return the resource path</param> /// <returns>Image</returns> public Image Image_FromResourceFile(string resourceFile, string resourceName, out string resourcePath) { Image image = null; resourcePath = ""; if (resourceFile == "IconFileExtentions") { Icon icon = AssetIconTools.File_IconForExtension(resourceName, enIconShell32Sizes.Icon32); image = icon.ToBitmap(); return(image); // =============================================================== } if (resourceFile == "") { resourceFile = "All"; } try { var resourceFileEnum = To_EnumValue <enBlueprintUIAssets>(resourceFile); // Get the BlueprintUIAssets enumeral } catch (Exception e) { // resourceFile error string error = string.Format("ERROR: Resource file '{0}' does not exist in {1}", resourceFile, _lamedWin.Assets.Namespace); throw new ArgumentException(error, "resourceFile", e); } if (resourceFile == "All") { image = Image_FromResourceFile(resourceName, out resourceFile); } else { image = Image_FromResourceFile(_lamedWin.Assets.Namespace + resourceFile, resourceName); } resourcePath = _lamedWin.Assets.Namespace + resourceFile + "." + resourceName; return(image); }