titel3
Aug 15th, 2001, 06:17 PM
In my application i put an array of labels at random places.
When placing the labels, i need to find all areas of the form, not allready occupied by labels.
Is there any way i can do this ?
Many thanks in advance.
TheBao
Aug 16th, 2001, 02:28 AM
When loading the label randomly, you need to have 2 random numbers (for top and left).
If you store these two number into a dynamic array, each time you generate another pair, make sure they are not in the range covered by previous labels.
For example: if first pair is (5,10) and label height, width is (20,50).
Thus you have a rectangle of coordinates (left, top properties)
1. Top left corner (5,5)
2. Top right corner (5,60)
3. Bottom left corner (25,60)
4. Bottom right corner(25,60)
If you get the rectangle, then you can use the polygon clipping techniques to get what you want.
Regards.