HighDPI change: controls do not scale at all, and/or not properly

Add-in Express™ Support Service
That's what is more important than anything else

HighDPI change: controls do not scale at all, and/or not properly
 
Sebastien Lange




Posts: 35
Joined: 2022-09-21
Hi,

I'm using DevExpress controls within my ADXOlForms.

As DevExpress recommend, I'm calling WindowsFormsSettings.SetPerMonitorDpiAware(); (first line of code in AddinModule ctor)
https://docs.devexpress.com/WindowsForms/116666/common-features/high-dpi-support
So everything should work fine?Â?Ð??

However, when I start Outlook and when I change resolution to 125% or higher, one of my ADXOlForm's controls do not scale at all! And another ADXOlForm's controls scales very "randomely"...

So to try to reproduce the problem, I have copied the simplest form controls inside a blank new WinForms app and blank normal Form class.
But everything works fine there!

So I imagine DevExpress controls somehow listen to https://docs.microsoft.com/en-us/windows/win32/hidpi/wm-dpichanged (thanks to WindowsFormsSettings.SetPerMonitorDpiAware())
I suspect controls receive the notification properly within a normal Form, but not within an ADXOlForm.


I know there's ADXDPIChanged event... but I would like to avoid updating myself controls bounds and font, and I would rather fall back to the normal mechanism of DevExpress...

So is there something special in ADXOlForm that prevent controls to react the same way they do in normal Form?

Thanks beforehand

Best regards,
S?bastien
Posted 18 Jan, 2023 05:33:37 Top
Sebastien Lange




Posts: 35
Joined: 2022-09-21
I noticed that Form.DpiChanged is fired within a normal Form, but ADXOlForm.DpiChanged is not fired.
I guess DevExpress relies on DpiChanged event...
Posted 18 Jan, 2023 07:44:20 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello S?bastien,

Your .NET application starts a .NET process and creates a main form which is supplied with a System.Windows.Forms.Application object. A COM add-in is a DLL, not an application. It works in a native process, not in the .NET process. The System.Windows.Forms.Application object does exist in this case but it doesn't work as expected. Plus, we suppose that the form doesn't receive some calls that .NET issues when in an application.

And an Add-in Express form is a child window in an Outlook window (= it isn't a main form) and some messages don't reach it. We solve this and an ADXOlForm does get the WM_DPICHANGED message (see https://www.add-in-express.com/creating-addins-blog/2021/06/17/dpi-scaling-details-office-addins/) and provides the OnDpiChanged event for you to react to this change. If DevExpress allows you to scale controls manually, then you can use this feature. If they don't let you do this, you'll have to invent something yourself.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Jan, 2023 06:11:31 Top