Is it possible to draw a line in the scrollbox with the onclick event and make it moveable?
To achieve it, basically you need to solve these 3 things:
1. Draw the lines
This is the easiest. If you don't know how to do it, here has an example code showing how to draw lines on a scrollbox's canvas and the canvas of the object inside the scrollbox:
https://forum.lazarus.freepascal.org/index.php/topic,66899.msg513831.html#msg5138312. Store the lines' information
Because you need to make them moveable, you need to store the basic information of the items. You can write your own data structure for information like: PosX, PosY, color, object_type, etc. And then you can use a dynamic array as the container for storing them. For more advanced usage you can use TList or FPObjectList. Here is a list of the available containers for Lazarus:
https://wiki.lazarus.freepascal.org/Data_Structures,_Containers,_Collections3. Sprite picking
This is hardest part. Even you got a fully working code, you may still scratch your head for understanding it. If all the items have basic geometry shapes, rectangle for example you need to loop the z-order and compare your mouse position with the shape's left-top most and right-bottom most coordinates. But if they have varies or irregular shapes, you need to use different method. Mr.Madguy provided a fully working code for irregular shape sprite picking technique:
https://forum.lazarus.freepascal.org/index.php/topic,36871.msg246309.html#msg246309Usually, I would provide a fully working demo but I'm sorry I am very busy recently. I cannot help.