


Than you do not have a choice und should use GetDPIForMonitor and check on what monitor the dialog is displayed.īest regards Bordon Note: Posted code pieces may not have a good programming style and may not perfect. At least since GetDPIForMonitor needs at least Win8.1.Īlso an additional note, my idea is not correctly working you you have multiple monitors with different DPI settings. I know this is kind of oldschool, but in old code this may be the eaiest solution. If you have 120DPI you need to multiply your current xs and xy with 1.25. The easiest way is getting the current DPI setting with function GetDeviceCaps and parameter LOGPIXELSX and/or Y. Here it is a nice article explaining how the high DPI stuff works: How do I get the right values for dialog size for all operating systems or monitor setting? Should run in the identical problem you see under Windows 10. Go to "Control Panel\Appearance and Personalization\Display" and change "Smaller - 100%" to the medium or larger setting. This should not a Windows 10 problem, you should be able to force the same problem in Windows 7. I hard-coded the size xs, ys, and that's fine for my Windows 7 but in Windows 10 some buttons are chopped off. VS2010 MFC is the first version supporting High DPI. The interesting part would be what VS version do you use. In my C++ MFC application, I am programatically changing the dialog size by using SetWinodowPos(NULL, x, y, xs, ys. To allow resizing to the designed dialog size, save the dialog's original rectangle. SetWindowPos( hDlg, NULL, 0, 0, width,, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE ) * Add in the height of the menu bar & frame *ĪdjustWindowRect( &rect, GetWindowLongPtr( hDlg, GWL_STYLE), false ) * Setup to re-size the height of the dialog * ScreenToClient( hDlg, ((LPPOINT) &rect)+1 ) GetWindowRect( GetDlgItem( hDlg, IDC_MARKER_CTL ), &rect )

* Get the screen co-ordinates of the marker control * * Preserve the original width of the dialog * Here's someĮxample code I use to shrink the height of a dialog: When the dialog initialises, get the marker control's position using GetWindowRect, and use that to resize the dialog. OK, what I'd do in this situation is to have a marker control in the dialog at the position you need to shrink it to. The the same button now changes to "Shrink". The user can click a button "Expand" to make the dialog longer horizontally to make a space for some jpg image.
