[Question/suggestion] Can System.Drawing.Graphics be PerMonitorV2 compatible?
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/DpiYproperties 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/DpiYproblem, then can we solve it - make them return real dpi? - If this is whole
Graphicsproblem, then can we solve it - makeGraphicscompatible withPerMonitorV2?
- If this is only
@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
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?
Really
GdipGetDpiXthe same asGetDeviceCaps(CreateICA("DISPLAY", NULL, NULL, NULL, LOGPIXELSX)?
Yep.
Do you think it would be appropriate to add new properties to the
Graphicsthat return the real DPI forPerMonitorV2?
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.
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?