我正在尝试在图片框的另一张图片上绘制一张图片。它们的尺寸相同(125X150)。当我在图片框的[0,0]点绘制第二张图片时,两张图片没有对齐。这是我的代码:
pictureBox1.Image = Image.FromFile("picture\\faces\\face3.png");
Bitmap bmp = new Bitmap(pictureBox1.Image);
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(new Bitmap("picture\\faces\\eyebow1.png"), new Point(0, 0));
g.Dispose();
pictureBox1.Image = bmp;
我自己弄清楚了。虽然我不知道为什么:
pictureBox1.Image = Image.FromFile("picture\\faces\\face3.png");
Bitmap bmp = new Bitmap(pictureBox1.Image);
Console.WriteLine(bmp.Width);
Graphics g = Graphics.FromImage(bmp);
pictureBox1.Image = Image.FromFile("picture\\faces\\eyebow1.png");
g.DrawImage(new Bitmap(pictureBox1.Image), new Point(0, 0));
g.Dispose();
pictureBox1.Image = bmp;