背景:
有时,我们需要从现有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>
/// <param name="data">The data.</param>
/// <returns><c>true</c> if the specified data is zip; otherwise, <c>false</c>.</returns>
private bool IsZIP(byte[] data)
{
if (data[0] == 0x50 && data[1] == 0x4b && data[2] == 0x03 && data[3] == 0x04)
{
return true;
}
291




被折叠的 条评论
为什么被折叠?



