I'm going to provide some "pointers" to the answer and it is Windows only. I have no idea how to do any of this stuff in Linux.
The problem with determining the dimensions of window elements is that the sizes seem to vary depending on factors that are often unclear. For instance, the Windows desktop manager and theme "manager" affect the sizes and it is not really clear how they decide the sizes. I faced that problem in a number of occasions for different reasons.
A reasonable, but not really simple, solution was obtained using AdjustWindowRect(Ex), GetWindowRect, GetClientRect and modifying window attributes that caused scrollbars, frames and other "items" to be included/excluded. Of course, all this done on a window that is not visible. A lot of acrobatics but, the results were accurate and reliable. Of course, this also implies pure API but, the knowledge obtained using pure API should be "portable" (might require a tweak or two) to "forms"/LCL.
Unfortunately, I don't have a sample program that calculates everything. In all cases I coded the stuff "on the fly" to reliably determine one or two item sizes. The last time I needed to figure out the Window size from the client size (which was fairly recently), I decided to "wing it" and simply used a calculated reasonable estimate which worked quite nicely (the window ended up being 2 or 3 pixels larger than it needed to be... I didn't think 3 pixels were worth the sweat to get rid of them... it looks perfectly fine, as if it had been done on purpose.)
I know the above isn't much help but, the point is: if you want accurate and reliable sizes, there is a fair amount of work involved in getting them.
Lastly, if someone has a genuinely simple solution that is portable across Windows versions that produces accurate and reliable results, I'd love to see it too.
HTH.