Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] Lazarus Pascal - How to get a Transparent TPanel
Delphi, Lazarus, Free Pascal
(@hans)
Famed Member Admin
Joined: 13 years ago
Posts: 3043
Topic starter
December 18, 2025 7:32 AM
Sometimes we use a TPanel for layout purposes, and in those cases the Panel should sometimes be transparent.
After having gone through numerous options, I found this to work under macOS/Cocoa (using FPC Trunk);
Originally this only worked under Windows, but it seems to work with Cocoa (with Lazarus 4.99 or newer - I am using trunk)
YourPanel.ControlStyle := YourPanel.ControlStyle - [csOpaque] + [csParentBackground];
As it took me quite a while to figure this one out: I hope this is helpful to someone 😊