> I can't find >code responsible for that in TCustomPanel. Any tips?
Most Lazarus libraries are not a single "*.pas" unit file, like Delphi, since the controls are implemented for several platforms & visual control libraries. So, you may have a "*.pas" file that references several "*.inc" include files.
Look for your FPC or Lazarus source code files. Search for "*.inc" files.
> Reason is delphi compability?
I agree that it can be messy, but, Delphi compatibility its also importanty, since a lot of developers here, have apps, originally builted in Delphi.
I also have tried to (re) built some visual controls from scratch, and copied or based some code from existing controls.
Good Luck.
