Android Question Draw a line between 2 points

extravert

New Member
Licensed User
I want to select 2 points on my screen and have my app connect them with a line.
i have no idea where to start....
 

eurojam

Well-Known Member
Licensed User
Longtime User
this is very little information that you provide to help you:
1. rule: the more information - the better the help will be
for exmaple: two points on the screen means what?: Points on a Map, points on a canvas - this is something where you can draw lines on?

best regards
stefan
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
B4X:
Global
private X1 as float=0
private Y2 as float=0
private Fisrttouch as boolean=True


Private Sub YourPanel_Touch (Action As Int, X As Float, Y As Float)
  
if Fisrttouch=true then
   X1=X
   Y1=Y
   Fisrttouch=false
else
    Dim cnv As Canvas
    cnv.Initialize(YourPanel)
    cnv.DrawLine(x1,y1,X,Y,Colors.Red, 5dip) '5dip stoke width
   Fisrttouch=true
  end if

end sub
 
Upvote 0
Top