d7_2_laz, how is procedure WMEraseBkgnd called? I noticed that it isn’t overriding ancestor method if there is any.
What if parent.color was substituted for Brush.Color := $00353535;?
I think it’s called by one ancestor of the control, here probably (without having debugged) controls.pp (see image).
And it will be called, as KodeZwreg says, 'automagical' by intercepting the windows message loop by the anchestor. You simply hook into this message for to do something within.
But - as you suspected - it probably Windows-specific, don't know if there are equivalents on other OSses.
For the second question: you mean: substitute the hard coded element by any variable, eg. parent.color? Yes, of course, the essential element is only that the “unwanted color” doesn’t stay visible .. and visible .. and visible .. until the painting will come into effect. But will be applied as early as possible. I had very good results by that (need to add that the dark theme here is by metadarkstyle component).