Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable High-DPI #467

Open
wants to merge 1 commit into
base: mainline
Choose a base branch
from
Open

Enable High-DPI #467

wants to merge 1 commit into from

Conversation

robnadin
Copy link

Enables High-DPI mode for Windows users running high resolution displays.

Text and labels should no longer look blurry on these devices.

@DanTheMan827
Copy link
Member

Last time I tried, there were issues with images not filling the control. Is this still the case?

@robnadin
Copy link
Author

It appears so. I would have thought setting SizeMode to Zoom would solve this for all PictureBox objects, or is there additional work needed besides that?

@robnadin
Copy link
Author

I think to get the thumbnail to render at a similar size as before we probably need to get the current window's DPI and scale the image based on that, assuming the default DPI is 96:

float dpiX;
using (Graphics graphics = Graphics.FromHwnd(IntPtr.Zero))
{
    dpiX = graphics.DpiX;
}

float scalingFactor = dpiX / 96f;

int newWidth = (int)(targetWidth * scalingFactor);
int newHeight = (int)(targetHeight * scalingFactor);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants