E enonod Well-Known Member Licensed User Longtime User Jan 16, 2013 #1 The Path object only seems to permit an absolute reference for initialization. If I want to draw a path onto an as yet unknown one of say 50 drawn rectangles, I have to specify the specific rectangle as opposed to, 'relative' to the chosen one. Is there a way around the problem of not therefore being able to store a path once and then simply apply it to a chosen rectangle? At present it 'appears' to me that as the rectangle is chosen I 'then' initialize the path and draw it, which means a lot of repeated initializing to different places to draw the same path.
The Path object only seems to permit an absolute reference for initialization. If I want to draw a path onto an as yet unknown one of say 50 drawn rectangles, I have to specify the specific rectangle as opposed to, 'relative' to the chosen one. Is there a way around the problem of not therefore being able to store a path once and then simply apply it to a chosen rectangle? At present it 'appears' to me that as the rectangle is chosen I 'then' initialize the path and draw it, which means a lot of repeated initializing to different places to draw the same path.
Erel B4X founder Staff member Licensed User Longtime User Jan 17, 2013 #2 You should create a BuildPath sub that will build a new path for you: Code: Copy Sub BuildPath(r As Rect) As Path Dim p As Path p.Initialize(r.Left, r.Top) p.LineTo(r.Right, r.Top) p.LineTo(r.Right, r.Bottom) p.LineTo(r.Left, r.Bottom) p.LineTo(r.Left, r.Top) Return p End Sub End Sub Upvote 0
You should create a BuildPath sub that will build a new path for you: Code: Copy Sub BuildPath(r As Rect) As Path Dim p As Path p.Initialize(r.Left, r.Top) p.LineTo(r.Right, r.Top) p.LineTo(r.Right, r.Bottom) p.LineTo(r.Left, r.Bottom) p.LineTo(r.Left, r.Top) Return p End Sub End Sub
E enonod Well-Known Member Licensed User Longtime User Jan 17, 2013 #3 Thank you, I will work on that Upvote 0