I looked at your project again, and the lfm file, in fact, contains an entry on DesignTimePPI=240. In the lpi code I see "Application.Scaled := true" which tells me that LCL scaling is active - and this is what I would have told you to activate. OK - you already did.
I've never worked with such a huge resolution, but I played with your demo on my Win7 VM which runs at 150% (144ppi). Indeed I see that the longest text in the auto-sized 1st column is truncated similar to your screenshot, but only by about 1 pixel.
Since the overall scaling is correct, and since only a few pixels are missing, my gut feeling tells me that this could be related to the cell border, varCellPadding. Luckily, this is a global variable in the Grids unit, and it can be changed to any value.
The debugger tells me that varCellPadding on my 144ppi system has the value 5. When I reduce it to 4 the longest text in the grid is not truncated any more!
Where does this issue come frome? It must be related to the AutoAdjustColumn method which is called by the AutoSizeColumns method. The method calculates the width of the longest text in the column (similar to your code) and then adds the cell margin. But instead of adding two times the value of varCellPadding (for left and right border) it adds a constant DEFAUTOADJPADDING=8 in Laz 2.0.10. This is a bug because the cell border must be scaled with screen resolution.
Going back to my standard Win10 development system which runs at 96ppi and looking at the same code position I see that this already has been fixed in Laz trunk.
So, this is what you can do to fix the issue for your Laz 2.0.10:
- Open the unid grids.pas
- Find the method TCustomStringGrid.AutoAdjustColumn
- Scroll towards its end and replace the DEFAUTOADJPADDING by "2*varcellPadding + 1" (the +1 probably is some safety measure)
- Finally, the end of the AutoAdjustColumn method should look like this:
W := W + imgWidth;
if W=0 then
W := DefaultColWidth
else
W := W + 2*varCellpadding + 1; // <---- CHANGE IN THIS LINE
ColWidths[aCol] := W;
When you recompile your program it should be correct now.