01-14-2014, 01:21 PM
Hi Gintaras,
Several of the computers at work are set to 125% = 120 DPI (Pixels/Dots Per Inch) instead of 100% (96 DPI). The Dialogs I created which have a toolbar-like row of buttons (with BMP or JPG's) across the top appear much wider at 100% (and therefore get cutoff as I am sizing them to a pre-existing application window). Everything gets fixed when I set the computer to 100% and re-login. However, this is an indiviudal user setting so every user would have to do this difficult step. I looked in help menu at DPI scaling functions and know I can detect the DPI setting with DpiGetDPI. This would allow me to have two versions of the toolbars hung and resized separately depending on the setting. However this is not so elegant and would rather have just one dialog setting that appears consistently at both settings. I read on StackFlow about AutoScale but I don't think this is a feature supported in QM.
http://stackoverflow.com/questions/93732...00-125-150
Is there any way to do this one set of code?
The window I am handing my Dlg on returns 0 on !DpiIsWindowScaled? when setting is at 100%
I geuss I should use DpiScale but not exactly sure how.
Does it make a difference whether I use bmp's or jpegs to skin my buttons?
S
Several of the computers at work are set to 125% = 120 DPI (Pixels/Dots Per Inch) instead of 100% (96 DPI). The Dialogs I created which have a toolbar-like row of buttons (with BMP or JPG's) across the top appear much wider at 100% (and therefore get cutoff as I am sizing them to a pre-existing application window). Everything gets fixed when I set the computer to 100% and re-login. However, this is an indiviudal user setting so every user would have to do this difficult step. I looked in help menu at DPI scaling functions and know I can detect the DPI setting with DpiGetDPI. This would allow me to have two versions of the toolbars hung and resized separately depending on the setting. However this is not so elegant and would rather have just one dialog setting that appears consistently at both settings. I read on StackFlow about AutoScale but I don't think this is a feature supported in QM.
http://stackoverflow.com/questions/93732...00-125-150
Quote:The correct way of handling variable DPI settings is not to detect them and adjust your controls' sizes manually in a switch statement (for starters, there are far more possibilities than those you show in your sample if statement). Instead, you should set the AutoScaleMode property of your form to AutoScaleMode.Dpi and let the framework take care of this for you.
Add the following code to your form's constructor (or set this property at design time):
this.AutoScaleMode = AutoScaleMode.Dpi;
Although you might prefer to use AutoScaleMode.Font. For more information on automatic scaling, see the MSDN documentation.
Is there any way to do this one set of code?
The window I am handing my Dlg on returns 0 on !DpiIsWindowScaled? when setting is at 100%
I geuss I should use DpiScale but not exactly sure how.
Does it make a difference whether I use bmp's or jpegs to skin my buttons?
S