This procedure swaps x1 and x2 and/or y1 and y2 so that the 1 values are less than the 2 values, and as such form a correct box, cause if the 2nd value is larger than the 1st it doesn't work.
SCAR Code:Procedure CorrectBox(var Box:TBox);
var
TPnt:TPoint;
begin
if Box.X1 > Box.X2 then
begin
TPnt.X := Box.X1;
Box.X1 := Box.X2;
Box.X2 := TPnt.X
end;
if Box.Y1 > Box.Y2 then
begin
TPnt.Y := Box.Y1;
Box.Y1 := Box.Y2;
Box.Y2 := TPnt.Y
end;
end;




Reply With Quote


Nifty idea, though.










