this happens because user has enabled Text Zoom in Windows settings. The problem arises from the fact that Windows automatically scales text according to user settings, but not forms and control placement (which you specify in pixels in plugins).
Take a look at this regular plugin code dealing with GUI:
- Code: Select all
f = new TForm(WeBuilder);
f.Width = 600;
f.Height = 670;
var pnlCurrentWBProject = new TPanel(f);
pnlCurrentWBProject.Parent = f;
pnlCurrentWBProject.SetBounds(14, 10, 568, 80);
Everything is fine on normal screens, but if someone (like me) would execute this code on Surface Pro, every normal pixel is twice as small on this screen so the text zoom is set to 200%, which means that for this form I will see a tiny form with tiny controls (two times smaller in width and height than on a regular screen) due to my DPI.
Here's how to fix it and make it DPI-aware:
- Code: Select all
f = new TForm(WeBuilder);
var mul = Round(f.PixelsPerInch / 96);
f.Width = 600 * mul;
f.Height = 670 * mul;
var pnlCurrentWBProject = new TPanel(f);
pnlCurrentWBProject.Parent = f;
pnlCurrentWBProject.SetBounds(14 * mul, 10 * mul, 568 * mul, 80 * mul);
The main thing to pay attention to is TForm.PixelsPerInch property. It is 96 on regular screens but bigger (according to Text Zoom setting) on High-DPI screens.
I hope that helps!