我知道以前有人问过这个问题,但我找不到适合我具体情况的答案。我试图从资源图像创建新的位图。
private void button1_Click(object sender, EventArgs e)
{
string test = "meridian_am";
string resources = "Resources.Properties.Resources." + test;
var master = new Bitmap(Resources.Properties.Resources.master);
var meridian_am = new Bitmap(resources);
using (Graphics g = Graphics.FromImage(master))
{
g.DrawImageUnscaled(meridian_am, 114, 332);
}
}
出于某种原因,对于 *var meridian_am = new Bitmap(resources)* 我得到一个无效参数错误。最终,我宁愿在运行中进行字符串连接,如 var meridian_am = new Bitmap(Resources.Properties.Resources . + 测试),但由于某种原因,这不起作用......有什么想法吗?