Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- @action: Returns/builds grid of boxes with parameters;
- startPoint = start point of the grid
- boxWidth, boxHeight = dimensions of all boxes
- rows, columns = count of rows and columns
- rowSpace, columnSpace = the space between points at rows and columns
- [==============================================================================}
- function TBAGrid(startPoint: TPoint; boxWidth, boxHeight, rows, columns, rowSpace, columnSpace: Integer): TBoxArray;
- var
- r, c: Integer;
- begin
- if ((rows > -1) and (columns > -1) and (boxWidth > 0) and (boxHeight > 0) and ((rows * columns) > 0)) then
- begin
- SetLength(Result, (rows * columns));
- for r := 0 to (rows - 1) do
- for c := 0 to (columns - 1) do
- Result[((r * columns) + c)] := IntToBox((startPoint.X + (c * columnSpace)), (startPoint.Y + (r * rowSpace)), ((startPoint.X + (c * columnSpace)) + (boxWidth - 1)), ((startPoint.Y + (r * rowSpace)) + (boxHeight - 1)));
- end else
- SetLength(Result, 0);
- end;
Advertisement
Add Comment
Please, Sign In to add comment