我正在尝试选择使用 openfiledialog 选择的图像区域我尝试选择的区域是 x,y 坐标 5,5 的 16x16 选择后,我想将 16x16 图像绘制到坐标 0 的另一个图片框中,0
这是我得到的代码,但我无法让它选择原始图像的正确部分,有人对它为什么不起作用有任何建议吗?
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK) // Test result.
{
Image origImage = Image.FromFile(openFileDialog1.FileName);
pictureBoxSkin.Image = origImage;
lblOriginalFilename.Text = openFileDialog1.SafeFileName;
System.Drawing.Bitmap bmp = new Bitmap(16, 16);
Graphics g3 = Graphics.FromImage(bmp);
g3.DrawImageUnscaled(origImage, 0, 0, 16, 16);
Graphics g2 = pictureBoxNew.CreateGraphics();
g2.DrawImageUnscaled(bmp, 0, 0, 16, 16);
}