Greetings, all, and thank you in advance for replying to my question.
I seem to have an issue with Canvas DrawText and Device Scale.
Note: tc(0) is the x coordinate in dips; tc(1) is the y coordinate in dips.
This code works in all my devices which have a scale with no decimal points. Scales tested: 1.0, 2.0 with varying resolutions: 1280 by 800, 1920 by 1080, 2560 by 1600, and others.
This code does not work with devices with scales with decimal points: 1.33 and 1.5 with resolutions 1280 by 800 and 1920 by 1200. It basically defaults to a scale of 1.
I have develop a workaround by establishing a multiplier for the x and y coordinates and multiplying tc(0) and tc(1) for their respective axis, but it is not as clean as the code above.
Any help will be welcomed.
Best regards.
Sandy
I seem to have an issue with Canvas DrawText and Device Scale.
B4X:
Canvas1.DrawText("X", tc(0)*1dip, tc(1)*1dip, Typeface.DEFAULT, 14, Colors.red,"CENTER")
Note: tc(0) is the x coordinate in dips; tc(1) is the y coordinate in dips.
This code works in all my devices which have a scale with no decimal points. Scales tested: 1.0, 2.0 with varying resolutions: 1280 by 800, 1920 by 1080, 2560 by 1600, and others.
This code does not work with devices with scales with decimal points: 1.33 and 1.5 with resolutions 1280 by 800 and 1920 by 1200. It basically defaults to a scale of 1.
I have develop a workaround by establishing a multiplier for the x and y coordinates and multiplying tc(0) and tc(1) for their respective axis, but it is not as clean as the code above.
Any help will be welcomed.
Best regards.
Sandy