One way to make it more accurate is to use a loop to check for collisions in between positions. Also if you restrict fence positions and sizes to grid positions it's simpler to keep it precise.
Loops will also enable the lines to be done instantly. For example:
http://dl.dropbox.com/u/5426011/examples17/fence.capx
For a horizontal line the detector moves from the starting position right to just shy of a fence then back left. That gives the start and end positions.
You can similarly find the top/left and bottom/right corners of a box in the same way. With that you can create a box to fill that area and check for collisions or calculate the area.