Results 1 to 2 of 2

Thread: Unoccupied window-space

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    4

    Talking Unoccupied window-space

    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.

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width