Icons corrupt, lose resolution, or quality in Winforms (Windows Forms) ListViews and TreeViews when using the ImageList control.
namespace CENTREL.Windows.UI
{
/// <summary>
/// Provides extension functions for image lists.
/// </summary>
public static class ImageListExtensions
{
/// <summary>
/// Adds images to the image list from the specified resource
manager.
namespace CENTREL.Windows.UI
{
/// <summary>
/// Provides extension functions for image lists.
/// </summary>
public static class ImageListExtensions
{
/// <summary>
/// Adds images to the image list from the specified resource
manager.
/// </summary>
/// <param name="imageList">The image list to which the images are to be added.</param>
/// <param name="resourceManager">The resource manager from which to add the images.</param>
/// <remarks>This is a workaround to the image degradation caused by the image
list control.</remarks>
public static void AddImagesFromResourceManager(this ImageList imageList,
ResourceManager resourceManager )
{
foreach (DictionaryEntry entry in resourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, true))
{
if (!(entry.Value is Image)) { continue; }
imageList.Images.Add(Convert.ToString(entry.Key), (Image)entry.Value);
}
}
}
}
Comments
Post a Comment