How to draw a lasso in a Canvas?

Hello all,

I am working on upgrading an older product which uses Xojo 2019 R1.1. I need to draw a lasoo around a group of objects, basically a solid or dotted line. I know the starting and ending x,y coordiates but have forgotten how to draw the line!

Can anyone provide some sample code to do this?

Thank you,
Tim

https://documentation.xojo.com/api/graphics/graphics.html#graphics-drawrectangle

see also shapes
https://documentation.xojo.com/api/graphics/object2d.html
you would make a method for your lasso and call it from within canvas paint event with g argument.
you can subclass your canvas to make it more functional and add own properties there.

Hello,
a none example

https://www.dropbox.com/s/3is3zoeykrlk591/lasso-in-window.xojo_binary_project?dl=1

1 Like

Hi RudolfJ

Thanks for the sample. I had to move the project to the latest 2022 R3.1 and it worked perfectly!

Another question for you, is there an equally easy way to draw a box or rectangle using similar code??

Thank you again!
Tim

Hello Tim
new Lasso Box - Point controll

https://www.dropbox.com/s/vltm3a106j3jr4f/Lasso%20-%20box-2.xojo_binary_project?dl=1

1 Like