BS PanelTrans is a high-performance helper unit for Lazarus (LCL) and Delphi (VCL). It allows developers to transform standard TPanel components into fully functional, modern UI controls.
Version 2.0 introduces a WinUI-inspired aesthetic, focusing on custom-drawn selectors and modern text inputs with focus-sensing dynamics.
The main intention is to allow complete customization of color and font for implementing custom color themes in your applications!
Note: The TBSPanelTransManager and the TBSPanelTransToolbar greatly simplify the management and destruction of custom controls.
The "brain" of your UI implementation. While you can create controls manually, using the Manager is highly recommended.
Centralized Control: Change properties (like Font or ParentColor) across all managed controls of the same class with one method.
Automatic Lifecycle: When the Manager is destroyed (typically in FormDestroy), it automatically frees all registered control objects.
Theme Switching: Ideal for toggling between Light and Dark modes at runtime.
The base class for classic transformations. It manages a TPanel and an optional TLabel.
Property Description
Caption The text displayed on the control.
Font / ParentFont Full control over text styling or inheritance.
Enabled / Visible Standard operational and visibility states.
Transparent Adjusts the control's opacity.
Cursor Defines the mouse cursor on hover.
These classes provide a modern Windows 11/10 aesthetic. They feature thin borders on the top, left, and right, with a dynamic solid border on the bottom.
TBSPanelAsEdit / TBSPanelAsMemo: Modern text entry with an optional Embedded Action Button (Unicode character) in the Edit class.
TBSPanelAsComboBox: A modern selection interface mimicking standard TComboBox behavior.
TBSPanelAsSpinEdit / TBSPanelAsSpinEditFloat: Modern numeric entry with integrated increment/decrement buttons for both integers and floating-point values.
Focus-Sensing: The bottom border automatically changes color when the control is focused.
WinUI Look: Flat design that blends perfectly with modern dark or light themes.
Implementation: These classes are specialized wrappers that provide standard TEdit and TMemo functionality within a styled panel container.
Special Feature: The Embedded Action Button (TBSPanelAsEdit)
Internal Button: A single Unicode character acting as a button.
Positioning: Can be aligned to the Left or Right (default).
Customization: Set any character (e.g., "🔍" for search, "X" for clear). Set to #0 to hide.
Event: OnButtonClick – A dedicated event for handling button interactions.
All editing and selection classes are equipped with:
Color: Sets the primary background/surface color.
IsDark: A boolean toggle that adjusts internal rendering (text contrast, border shades) to align with a Dark or Light theme.
Note: These controls do not automatically respond to system theme changes. The developer should update these properties (ideally via the Manager) when a theme change is desired.
To achieve a true WinUI look, these controls have been completely decoupled from standard internal TCheckBox and TRadioButton components. They are now custom-rendered for pixel-perfect accuracy.
Visuals: Modern WinUI check-box styling.
State: Controlled via the Checked property.
Event: OnClick.
Visuals: Modern WinUI circular radio styling.
Grouping: Includes a GroupId property. Radio buttons with the same GroupId and the same Parent will act as a single selection group.
Event: OnClick.
Transform a panel into a high-performance Button, Speed Button, or BitBtn.
Styling: Supports HoverColor, ClickColor, DownColor, BorderColor, and RoundCorners.
Action Support: Fully compatible with TAction. It monitors action properties via an internal timer to update state and appearance automatically.
Glyphs: Supports TImageList (via Images and ImageIndex) or direct Picture assignment.
Extras: Can trigger a TPopupMenu on click and supports ModalResult.
A clean transformation that draws a distinctive, theme-aware border around the panel area to group related controls.
Property: BorderColor.
A specialized manager for toolbars. It transforms a TPanel into a button container.
Internal Manager: It uses its own TBSPanelTransManager to handle the lifecycle of all hosted TBSPanelAsButton items.
Automatic Layout: Simplifies the creation of custom-styled toolbars without the limitations of standard toolbar components.
Invalidate: Forced refresh of the control's appearance.
PrcSetupColors: Utility to quickly assign color schemes (light/dark) based on a primary color.
Click: Programmatically triggers the OnClick event.
OnClick: Standard notify event for all interactive controls.
OnButtonClick: (Edit only) Triggered when the embedded Unicode button is pressed.
The demo written in Lazarus contains the full helper unit, uBSPanelTrans. Please run the demo to see BS PanelTrans in action and learn more about its implementation.
The pictures below are screenshots of the demo showing how BS PanelTrans transforms panels, compared side-by-side with the standard controls.
BS PanelTrans is designed to give your Lazarus/Delphi applications a competitive, modern look with minimal effort. By utilizing the Manager class, you ensure that your code remains clean and your application memory-safe.
I welcome your feedback, bug reports, and suggestions!
Cheers!