Home

Bitmap dumped in result window should not scale with high DPI

edited July 18

Let's say this code:

GetScreenBitmap().Dump();

Bitmap GetScreenBitmap()
{
    Rectangle b = Screen.GetBounds(Point.Empty);
    Bitmap bmp = new Bitmap(b.Width, b.Height);
    using Graphics g = Graphics.FromImage(bmp);
    g.CopyFromScreen(new Point(b.Left, b.Top), Point.Empty, b.Size);
    return bmp;
}

The dumped result image is actually much much bigger than the screen size, especially in high DPI screen. (>150%)

I believe there should be something we can do to make it better.

Sign In or Register to comment.