In GUI code, a mapping mode is sometimes used to do this :
SetMapMode function (wingdi.h) - Win32 apps | Microsoft Docs[
^]. You can set the mapping mode so regardless of the actual window dimensions it looks the same to drawing code so if the window is bigger the drawing is scaled accordingly and automatically. I think it MM_ISOTROPIC or MM_ANISOTROPIC, I can't remember which. Further reading should clarify this.
FWIW, I haven't dealt with this issue in quite some time. I use GDI+ when I need to do this kind of thing and set a scale transform to handle it.