var maxW, maxH, // width and height when maximized
LBW,TBH:integer; // left border width, top bar height
point:TPoint;
begin
point.X:=Form1.Left; // left edge of Form1's left border, this is OUTSIDE of Form1's working area
point.Y:=Form1.Top; // top edge of Form1's title bar. again, this is OUTSIDE of Form1's working area
LBW:=-Form1.ScreenToClient(point).X; // ScreenToClient converts to (negative) left border width, sign changed so LBW is positive
TBH:=-Form1.ScreenToClient(point).Y; // ScreenToClient converts to (negative) title bar height, sign changed so TBH is positive
maxW:=Form1.Monitor.WorkAreaRect.Width-(LBW*2); // decrease width. ASSUMES Form1's right border is the same width as left border
maxH:=Form1.Monitor.WorkAreaRect.Height-(TBH+LBW); // decrease height. ASSUMES Form1's bottom border is the same width as left border
// note: WorkAreaRect ***excludes*** the taskbar
end;