Reputation: 7459
I want to set a CheckBox on the top of a GroupBox like in this picture to enable/ disable the groupBox:
but in this position, the checkBox is contained within the GroupBox child controls, so it is disabled once I disable the GroupBox..
So Is there a way to keep it in this location , but excluding it from the groupBox controls? I tried, Bring to front, but doesn't help!
Upvotes: 1
Views: 2425
Reputation: 4981
I'm assuming you're trying to do this via the designer? If so, then as soon as you move the CheckBox
over the GroupBox
, the designer will automatically assume (not unreasonably), that you want the CheckBox
to be contained by the GroupBox
.
To get around this, drag the CheckBox
outside of the GroupBox
, right-click on the CheckBox
and select "Bring to Front" so that it will be drawn on top, and then edit the CheckBox
's position manually via the Location
property in the Properties window.
Don't modify the CheckBox
's position via the mouse afterwards or the designer will put it back into the GroupBox
and you'll have to reposition manually again.
Alternatively you can do this programmatically as seen here (credit o_O).
Upvotes: 4