C#DrawImage绘制背景图片太模糊了怎么办

2025-01-04 08:44:28
推荐回答(2个)
回答1:

g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
DrawImage之前加上这两行代码立马就清晰了。

回答2:

码如下
Bitmap box1 = new Bitmap(pictureBox1.Image);
Bitmap box2 = new Bitmap(pictureBox1.Image.Width, pictureBox1.Image.Height);
Graphics g = pictureBox2.CreateGraphics();
g.Clear(this.pictureBox2.BackColor);
float x = (float)Double.Parse(textBox2.Text);
g.TranslateTransform(x, x);
g.DrawImage(box1, this.pictureBox2.ClientRectangle, 0, 0, box2.Width, box2.Height, GraphicsUnit.Pixel);
很简单的代码,立刻就画出来了。但是我发现