+2  A: 

A simple solution would be to put enough space characters into the TGroupBox.Caption property. A more complicated solution would be to derive from TGroupBox and use FillRect/DrawParentBackground in the Paint method to over paint the line.

Andreas Hausladen
+1 @x-ray I think this is your best solution. It means that you will still get a themed background (which you want, otherwise you will get a block that doesn't fit the background), and you get a nice gap to put your checkbox into.
Nat
A: 

In the past I have just added a blank TLabel behind the checkbox.

It makes maintenance a bit of a pain though

Gerry
A: 

Doesn't the Color property on the TCheckbox do it?

In your picture above, I think you can get what you want if you set the Color to same as the color of the control. That will hide the lines under the text that is part of the control and make it blend in.

Since you won't know the color in advance (due to not knowing what theme is in use) you'll want to do it dynamically at run time when the form is created, e.g.:

Checkbox.Color := Control.Color;
lkessler
He can also get the white background with the code he mentioned, calling `SetWindowTheme`. The second image isn't what he wants, either. He wants the background of the check box to match the background of the group box and the group box's parent. The background of any given control is not necessarily a solid color.
Rob Kennedy
Thanks Rob, I didn't quite answer that correctly. I've modified it to now suggest setting the color dynamically to the same as the control.
lkessler
A: 

thank you all for your answers. in the end, i did this:

  1. padded the beginning of the groupbox caption programmatically with spaces to the correct width.

  2. move the checkbox (without a caption) into the caption area.

it's not a perfect solution but it seems ok.

X-Ray