Windows HIDPI handling gaps when drawing

I have been wondering, what is the strategy to handle gaps that can happen when drawing on Windows HI-DPI ?

Its like if I am drawing many rows for example like following where X is the fill color or picture:

XXXXXXXX
XXXXXXXX
XXXXXXXX

Then I sometimes battle that I get random Gaps between the rows on Windows HI-DPI, which I am assuming happens because Xojo draw API uses Integers but the Windows draw API under the hood uses float and we get some rounding issues when we are at strange DPI such as 175% ??

Make sure you always scale downward instead of rounding to the nearest pixel.

Thats the issue I am not really scaling anything I just got off screen picture that gets into HIDPI mode

I draw boxes on it in sequence (to represent rows)

Then I draw the picture unscaled. (having cliping context)

Then On rare occasions there will be tiny gap between the rectangles when using DPI such as 175%

thats this effect (as least as far as a listbox is concerned)
<https://xojo.com/issue/48802>

[quote=341128:@Norman Palardy]thats this effect (as least as far as a listbox is concerned)
<https://xojo.com/issue/48802>[/quote]

Yes sounds about right

Yes, in my case its when porting the TreeView control to HI-DPI on Windows.

Am really not sure how to handle it since the reason is loss of precision in the Xojo Drawing API

You could set the scale of the Graphics context to 1, do your drawing at whatever the scale needs to be and then set it back.

That just makes everything tiny since I am drawing off screen buffers in the Rows and not really just rectangles. Where the Off screen buffers are of course at same DPI as the base context.

(Probably also why the Xojo List box has not been fixed with such solution)