背景:
有时,我们需要从现有Winform程序中得到程序中的相关图片。
但是,有些项目中,图片嵌入到资源文件中,但在资源浏览器中无法查看到相关图片,这时,就需要用类似本程序来导出所有资源图片了。
关键代码:
string ImagePath = @"images";
public Dictionary<string, object> Resources { get; private set; }
private CultureInfo _culture;
ComponentResourceManager _resourceManager;
private void btnGetAllPng_Click(object sender, EventArgs e)
{
_resourceManager = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
Resources = new Dictionary<string, object>();
_culture = CultureInfo.CurrentUICulture;
LoadAndSaveBitmapAsPng();
}
/// <summary>
/// Determines whether the specified data is zip.
/// </summary