I created a control based on TGraphicControl that is transparent and mostly empty space. It actually implements a simple symbol in line art.
i.e. TLFMagicControl = class(TGraphicControl)
In the constructor which I have:
ControlStyle := ControlStyle + [csOpaque];
My "TLFMagicControl" is then placed on my own panel that is a TCustomControl. i.e. TLFGridPanel = class(TCustomControl)
The transparency of the TLFMagicControl works perfectly interacting with each other but not with the parent panel they are on (TLFGridPanel).
The TLFGridPanel spends most of its time just black so its not an issue but I want to user to be able to turn on/off grid lines on the panel. When I override the paint handler TLFGridPanel and draw my grid the controls placed on top are not transparent and block the grid lines underneath.
Is there a way around this for a TCustomControl or have I chosen the wrong base for my panel?
csOpaque
tells the VCL that you draw the control entirely by yourself, which supresses the automatic background drawing (or erasing). Remove that control style in order to let WM_ERASEBKGND
do its work.