Android Question Canvas coordinate

rossati

Active Member
Licensed User
Longtime User
Hi
I am drawing an horizontal line at a fixed top coordinate in a canvas associated to a panel (B4A) and that line appears at differents levels depending oh the panel Height.
This means that the canvas coordinates are relative to the panel dimension??
Thanks
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
... that line appears at differents levels depending oh the panel Height.
I think that we need to see your code. Canvas coordinates are not related to the canvas size. This code ...
B4X:
    Dim cvs As Canvas
    cvs.Initialize(Panel1)
    cvs.DrawLine(0, 15, 100%x, 15, xui.Color_Black, 2dip)
    Panel1.Invalidate
... will draw a horizontal line that is always the same distance (on the same device) from the top of Panel1 no matter what the height of Panel1.
 
Upvote 0
Top