In a high DPI environment, the C++ ocx receives different cx,cy values in OnSize in the running state and the design state.

  • Thread starter Thread starter Hi, Shirley
  • Start date Start date
H

Hi, Shirley

Guest
I have an ocx project implemented in C ++ MFC and enables High DPI awareness.

For example, I now set the system DPI to 175%.

In the run-time state, the cx and cy received by OnSize are 1.75 times that in the Design state, respectively. That is, the Design state displays a high DPI screen, and the running state displays a low DPI screen.

In addition, in the case that the size of the screen is not adjusted, the control position obtained by GetWindowRect is different in the runtime state and the design time state.

OCX Ctrl inherits COleControl. Each control is created in this Ctrl class. The specific position of each control is calculated by GetClientRect. A problem arises because GetClientRect returns different values at runtime and design time.

Any suggestions? Thanks.

Continue reading...
 
Back
Top