Try it. Graphics will not "replace" the image when using DrawImage - it draws the input image at its source, which is the same as the image you are trying to draw.
Perhaps this is a shorter way to do this, but .....
Bitmap b = new Bitmap(control.Width, control.Height); using (Graphics g = Graphics.FromImage(b)) { g.CopyFromScreen(control.Parent.RectangleToScreen(control.Bounds).X, control.Parent.RectangleToScreen(control.Bounds).Y, 0, 0, new Size(control.Bounds.Width, control.Bounds.Height), CopyPixelOperation.SourceCopy); } Bitmap output = new Bitmap(newWidth, newHeight); using (Graphics g = Graphics.FromImage(output)) { g.DrawImage(b, 0,0,newWidth, newHeight); }
source share