Delphi VCL application layout changes when switching theme

Windows 10 paints the border of a window with a 1 pixel wide line in dark color immediately outside of the client area. In addition, outside of this 1 pixel line it paints a 6 or 7 pixels wide light shadow or optionally fully transparent. (The shadow / no shadow is selectable from Performance settings.

Most, if not all (I didn't check) styles, paint the border in a more traditional way, with a clearly visible 7 pixels wide border.

Here, an example of Windows 10 (no style):

enter image description here

And here a dark style (Carbon):

enter image description here

Finally also the Light style

enter image description here

To use the Light and the Carbon styles gives a similar looking light and dark layout.