Visual studio MFC dialog editor seems broken on my HiDPI monitor - is this a known problem?

415 Views Asked by At

I am coding a C++ project using MFC in Visual Studio (v16.5.4). The dialog editor seems badly broken on my HiDPI monitor (Lenovo ThinkVision 2880x1800 at 175%). It works fine on two other computers with standard monitors.

The dialogs get resized apparently randomly, and controls do not move correctly when I try to edit them. When I try to align controls the dotted selection rectangle may move, but the control often does not (in the editor). Sometimes, re-opening the editor shows that the control has in fact moved. When I build the project, the final display layout cannot be predicted from what appears in the resource editor.

I reported this to Microsoft using Visual Studio feedback, but they closed the report, saying it was "By design"!!!! They posted a link describing a feature which disables HiDPI awareness, but the link was for the Windows Forms Designer, not the MFC resource editor - there is no equivalent feature in the latter that I could find.

Does anyone else have this problem, or know of a decent work-around? At the moment I am transferring to my other computer with the standard display whenever I need to edit a dialog, which is monumentally inefficient for quite a large project.

2

There are 2 best solutions below

0
On

I have had the same problem with an external monitor resolution of 3840 x 2160 and the scaling set to 175%. During my search I found an interesting setting in VS 2019 (16.11.27) which seems to be the cause. Under the VS 2019 menu TOOLS | Options | Environment | General | “Optimize rendering for screens with different pixel densities” when selected this causes the resource editor problems, when switched off the resource editor works on a scaled monitor as well. According to MS the setting helps the code font to be sharper (font becomes a bit blurred when switched off). This may help some searching for the problem!

0
On

I know this is an older post, but I thought what I found might help someone. I experienced the same issue today. It just happens that I have one monitor setup for 125% and one setup for 100%. The MFC dialog editor alignment operations do not work correctly on the 125% monitor but work fine on the 100% monitor. It would appear Microsoft isn't properly handling DPI in the dialog editor.