如何返回清晰的图像

时间:2017-01-01 10:42:52

标签: c# image graphics bitmap

例如,我在PictureBox中加载大图像(11000x8000),然后在其上绘制线条等。

如何从hadrdrive或内存中返回清晰图像 WITHOUT RELOAD 。我的东西有图片框或图形替代谁可以这样。 现在我使用临时位图来清洁图像

Bitmap bitmap = new Bitmap(TempBitmap);
Graphics g = Graphics.FromImage(bitmap);
Point gPoint = Utils.GameToPoint(p, Image.Width, Image.Height, 2);
g.DrawLine(new Pen(Color.Red, 2), gPoint.X - 5, gPoint.Y + 5, gPoint.X + 5, gPoint.Y - 5);
g.DrawLine(new Pen(Color.Red, 2), gPoint.X - 5, gPoint.Y - 5, gPoint.X + 5, gPoint.Y + 5);
Image = bitmap;
base.CenterAt(gPoint);

1 个答案:

答案 0 :(得分:0)

无法撤消对图片所做的更改。你只有两种可能性:

  1. 重新加载图片(你不想要的)

  2. 制作您自己的控件(继承自picturebox)并覆盖OnPaint方法。每次刷新都会调用该方法。先打电话base.OnPaint,然后画出你所有的东西。但是每次刷新都必须重复这种绘制调用。