1

I have a combo box and a button on my form. When the application strts, Delphi scales everything on the form to the new monitor dpi. After this, I want to make the height of the button the same size as the height of the combo box, because they are not scaled right.

I tried to do this in form OnCreate, OnActivate, OnShow, but everytime I read the height of the combo box I get the unscaled value... And if I set this to button height it will remain smaller.

I even override the ChangeScale method of the form, but it seems that is not called at startup...

I don't know what else I could do...

Marus Gradinaru
  • 2,824
  • 1
  • 26
  • 55
  • Perhaps OnResize will work? – Matthias B Jun 02 '20 at 13:55
  • Override your form's Loaded method. – MartynA Jun 02 '20 at 14:37
  • @MartynA I tried but is not working... I get the same unscaled value of the combo box :( ... And I don't understand why, because the code that scales the form is in the `Loaded` method, and I checked the value after I call `inherited`... – Marus Gradinaru Jun 02 '20 at 15:41
  • Could it be an effect of IntegralHeight? If IntegralHeight = True, the combobox will not get exactly the Height you (or Delphi's scaling) set it to, but something near that - something that makes full rows visible. Could that be part of the mystery? – Matthias B Jun 02 '20 at 16:06
  • @MatthiasB Someting like that... `TComboBox` does not have an `IntegralHeight` property, but the problem is the same. It seems that it doesn't care what height you choose, it will override it with it's own value. And that mess up with control scaling. – Marus Gradinaru Jun 02 '20 at 16:17

0 Answers0