Hello!
Many developers are looking for a way to add a TProgressBar to a TStatusBar, display an image, or customize its colors. Well, I got tired of searching... so I created one!
TMyStatusBar is an advanced, custom-drawn status bar component for Lazarus, built from the ground up using TCustomControl. It provides a modern, flexible, and feature-rich alternative to the standard TStatusBar, offering extensive customization options for each panel.
This component was designed to be a complete, self-contained solution, handling all its drawing internally without relying on wrapping a standard TStatusBar.
Features: Multiple Panel
Styles: Each panel can be individually configured to display different types of information.
- psText: Displays standard text with custom font and color for each panel.
- psProgress: A highly customizable progress bar with several animation styles.
- psImage: Displays an image from a TPicture property.
- psKeyIndicator: Shows the status of keyboard keys like Caps Lock, Num Lock, etc.
- psOwnerDraw: Allows for completely custom drawing.
Advanced Progress Bar: The psProgress style offers much more than a simple bar:
Position, Min, Max, and Step properties, just like a standard TProgressBar.
Animated Marquee Styles:
- pbstNormal: A standard progress bar.
- pbstMarquee: A scrolling block for indeterminate processes.
- pbstMarqueeBounce: A "bouncing ball" animation.
- pbstMarqueeKITT: A "Knight Rider" scanner effect with a fading trail. :-)
Full Customization:
- Set the background Color for the entire status bar or for each panel individually.
- Set the Font (including text color, bold, italic, etc.) for each panel.
- Customize the color of the panel separators with the SeparatorColor property.
- Customize the color of the progress bar itself with the ProgressBarColor property for each panel.
- Enable or disable the SizeGrip at the corner.
How to Use
Installation: After installing the component package, you will find TMyStatusBar on the 'MyPack3' tab of the component palette.
Placement: Drop a TMyStatusBar component onto your form. It will automatically align to the bottom.
Adding Panels:
Select the TMyStatusBar component.
In the Object Inspector, find the Panels property and click the (...) button to open the collection editor.
Click "Add" to create new panels.
Customizing Panels:
- Select a panel in the collection editor.
- In the Object Inspector, you can now set its Width, Text, and all the custom properties like Style, ProgressStyle, Color, Font, etc.
- Changes are visible in the form designer at design-time.
This component is designed to be a versatile and visually appealing replacement for the standard status bar, giving developers full control over its appearance and functionality.
Updates by wp:I am attaching a version of your unit, along with a small test project, in which some possible short-comings related to LCL-scaling are avoided
- Introduced an imagelist to provide the images for the psImage-style panels; the old Picture property is kept alternatively.
- Some hard-coded lengths were replaced by variables calculated for the current pixel density (p8 = 8px at 96ppi --> 12px at 144ppi)
- I removed the newly declared AutoSize property. Its functionality already exists in TControl and needs not be implemented again. It is sufficient to just override the CalculatePreferredSize method. I refined this method to consider also the size of the images and the text height specific for individual panels having a different font than the statusbar itself. I assumed that the psText panels are drawn with the panel.Font, but maybe this is wrong - maybe this should apply to the psCustom panels.
The provided project was written at 96 ppi. It looked reasonable also at 144 ppi, including scaling of the image panel.
UPDATED ON 2025-09-15 - small modifications
The latest version is:
Here