Eto controls with custom height and DPI scaling

Hello,

I’m currently using some controls with custom sizes on an Eto Dialog on Windows.

Although I’ve read here and there in this forum that setting custom heights on certain Eto controls (TextBox, DropDown, etc.) is not recommended, I was trying to squeeze some controls by a bunch of pixels so that my dialog (containing a lot of controls) gets a little more compact.

All is rendered fine, on screens with standard 96 DPI, and for instance, texts inside TextBoxes is still readable.

But when the same dialog is displayed on a larger monitor with an applied scale of 175% (that is, the Screen.PrimaryScreen.LogicalPixelSize returns 1.75 rather than 1.0) the controls result in being a little too small to contain the texts (the text is cropped at the bottom).

I thought that I would need to multiply the “custom heigth” for the actual scale (1.75), but it seems too much.
Maybe the controls and fonts do not scale proportionally, so that the rendered text is too big to be displayed entirely in its containing control?

I couldn’t find a way to apply a scaling factor suitable for both scaled/unscaled screens, though I tried to consider LogicalPixelSize, RealDPI, RealScale etc.

I’m asking this just out of curiosity, if there is no way to solve the problem I will just leave the controls with their self-computed height.

Thanks,

1 Like

@curtisw any suggestion? Thanks :slight_smile:

Hey @p.stragliotto, the only suggestion I could give is to set the font size of your text boxes to something smaller.

The sizes you set on the Eto controls are in logical units already (so no need to multiply those), but there could be some rounding applied to get things to be crisp (fall on pixel boundaries), and the default font size could be different based on the DPI chosen which could be a factor here.

Hope this helps!