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

[Question/suggestion] Can System.Drawing.Graphics be PerMonitorV2 compatible? #12133

Open
kirsan31 opened this issue Sep 13, 2024 · 4 comments
Open
Labels
api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation area-HDPI HDPI, not specific to Dpi mode of app area-HDPI-PMv2 Issues related to high DPI PerMonitorV2 mode untriaged The team needs to look at this issue in the next triage

Comments

@kirsan31
Copy link
Contributor

kirsan31 commented Sep 13, 2024

Background and motivation

Currently in PerMonitorV2 apps after autoscaling happens (dpi changed) DpiX/DpiY from Graphics objects (for example from OnPaint(PaintEventArgs e)) still return starting values. This raises some questions (I found many similar questions, but no answers):

  • Is it only DpiX/DpiY properties problem and we still able to use these graphics objects normally (keeping in mind real dpi of course)? The fact that these objects continue to be used normally within Winforms gives me a certain optimism on this matter :)
    • If this is only DpiX/DpiY problem, then can we solve it - make them return real dpi?
    • If this is whole Graphics problem, then can we solve it - make Graphics compatible with PerMonitorV2?
@kirsan31 kirsan31 added api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation untriaged The team needs to look at this issue in the next triage labels Sep 13, 2024
@JeremyKuhne JeremyKuhne added area-HDPI-PMv2 Issues related to high DPI PerMonitorV2 mode area-HDPI HDPI, not specific to Dpi mode of app labels Sep 13, 2024
@JeremyKuhne
Copy link
Member

JeremyKuhne commented Sep 18, 2024

@kirsan31 I don't think there is much we can do here other than document what this really does. There is no way to set the DPI in GDI+ and it is effectively hard coded to a static that is:

GetDeviceCaps(CreateICA("DISPLAY", NULL, NULL, NULL, LOGPIXELSX);

@JeremyKuhne JeremyKuhne added 📭 waiting-author-feedback The team requires more information from the author and removed untriaged The team needs to look at this issue in the next triage labels Sep 18, 2024
@kirsan31
Copy link
Contributor Author

@JeremyKuhne

Really GdipGetDpiX the same as GetDeviceCaps(CreateICA("DISPLAY", NULL, NULL, NULL, LOGPIXELSX)?

I don't think there is much we can do here other than document what this really does.

I think yes to edit docs a bit will be helpful.

Do you think it would be appropriate to add new properties to the Graphics that return the real DPI for PerMonitorV2?

@dotnet-policy-service dotnet-policy-service bot added untriaged The team needs to look at this issue in the next triage and removed 📭 waiting-author-feedback The team requires more information from the author labels Sep 20, 2024
@JeremyKuhne
Copy link
Member

Really GdipGetDpiX the same as GetDeviceCaps(CreateICA("DISPLAY", NULL, NULL, NULL, LOGPIXELSX)?

Yep.

Do you think it would be appropriate to add new properties to the Graphics that return the real DPI for PerMonitorV2?

It might be misleading as I believe the current DPI setting actually impacts rendering. I'd have to dig into where the setting is used internally.

@JeremyKuhne JeremyKuhne added 📭 waiting-author-feedback The team requires more information from the author and removed untriaged The team needs to look at this issue in the next triage labels Sep 20, 2024
@kirsan31
Copy link
Contributor Author

It might be misleading as I believe the current DPI setting actually impacts rendering.

It was my main question. Currently my thoughts are - if they were involved in rendering, how then we would be able to draw windows correctly in PerMonitorV2 applications?

@dotnet-policy-service dotnet-policy-service bot added untriaged The team needs to look at this issue in the next triage and removed 📭 waiting-author-feedback The team requires more information from the author labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion (1) Early API idea and discussion, it is NOT ready for implementation area-HDPI HDPI, not specific to Dpi mode of app area-HDPI-PMv2 Issues related to high DPI PerMonitorV2 mode untriaged The team needs to look at this issue in the next triage
Projects
None yet
Development

No branches or pull requests

2 participants