Good day All,
I am developing a program that will resemble warehouse in a "graphical" manner. The representation is very basic and I am using: 1. TGroupBox (as parent container) 2. TPanel (as the shelves in the "warehouse" aka parent container.
The challenge I need help with. If I have 2 or more Groupboxes to draw dynamically. How can I determine the next Point to start drawing. So far my code is working very well with only 2 Groupboxes but I need an intelligent algorithm or way to calculate the next point on my canvas to draw the warehouse.
I am sure I can do this by scanning pixel for pixel and check of another components is at that point but there must be a more cleverly algorithm that can assist :)
Also remember the Groupboxes could be rectangles, square. IOW: Height & Width can differ.
How can I do this?
EDIT1: Sorry my explanation might be lacking. I am not painting them myself. Just creating them in code and positioning them dynamically. Unfortunately I can not post a picture due to reputation points too low. I will try to explain better. Let say I have 3 warehouses. Warehouse 1 contains 2 rows and 3 columns (shelves). And Warehouse 2 contains 20 rows and 5 columns. I have created Warehouse 1 (Groupbox Component) in code, positioned it at point 0, 0 on my parent control. Warehouse 2 can now either be created to the right or bottom of Warehouse 1. Depending on what makes most sense (screen real estate) in terms of the open space available on parent. And then also for Warehouse 3, how can I in code determine where to place it on my parent container? Position? And obviously I cant just always assume to draw the next warehouse to the bottom of the previous one. The previous warehouse might for example - only contain 1 row and 1 shelve which will make it a very small in size and and therefore it will make sense to draw next warehouse to it's right. But if previous warehouse's width is large then it would make sense to draw next warehouse to its bottom.
http://www.programmer.co.za/downloads/SOW.png http://www.programmer.co.za/downloads/SOW.png