TMSFNCStatusBar
The TTMSFNCStatusBar is a component for displaying different styles of panels. These styles include simple text, ellipse text, HTML text, images, date, time, progress bar and custom drawing can be made too.
Custom panel
There are various styles of panels, but drawing your custom panel is also possible. You can achieve this by implementing the OnDrawCustomPanel event.
procedure TForm1.FormCreate(Sender: TObject);
var
p: TTMSFNCStatusBarPanel;
I: Integer;
begin
TMSFNCStatusBar1.BitmapContainer := TMSFNCBitmapContainer1;
for I := 0 to 3 do
TMSFNCStatusBar1.Panels.Add;
p := TMSFNCStatusBar1.Panels.Items[0];
p.Style := spsOwnerDraw;
p.Width := 100;
end;
procedure TForm1.TMSFNCStatusBar1DrawCustomPanel(Sender: TObject;
AGraphics: TTMSFNCGraphics; ARect: TRectF; APanel: TTMSFNCStatusBarPanel);
begin
AGraphics.DrawEllipse(ARect);
end;
Images
It’s also possible to show images in a panel with the use of a TMSFNCBitmapContainer. You can set the panel style to spsImage or spsImageList. The spsImage can be used if a single image and optional text have to be shown. The spsImageList will display a given amount of images (Panel.ImageCount) from the desired index (Panel.ImageIndex).
p := TMSFNCStatusBar1.Panels.Items[0];
p.Style := spsImage;
p.ImageIndex := 0;
p.Text := 'Cursor';
p.AutoSize := True;
p := TMSFNCStatusBar1.Panels.Items[1];
p.Style := spsImageList;
p.ImageIndex := 1;
p.ImageCount := 3;
Progress bar
Every single panel has a Progress property which includes many options for the progress bar to be set. There are 4 levels you can play around with and set them to your own preference. The limit of the levels can be set via the Panel.Progress.Level1Perc and Level2Perc properties.
Level 0 goes from Panel.Progress.Min to Panel.Progress.Level1Perc.
Level 1 goes from Panel.Progress.Level1Perc to Panel.Progress.Level2Perc.
Level 2 goes from Panel.Progress.Level2Perc to Panel.Progress.Max – 1.
Level 3 equals to Panel.Progress.Max.
p := TMSFNCStatusBar1.Panels.Items[3];
p.Style := spsProgress;
p.Progress.Level1Perc := 50;
p.Progress.Level2Perc := 75;
p.Progress.Position := 30;
p.Progress.Position := 55;
p.Progress.Position := 80;
p.Progress.Position := 100;
Methods
Method name | Description |
---|---|
XYToPanel(AX, AY: Single): TTMSFNCStatusBarPane | Returns the panel at the given X, Y coordinates. |
GetPanelRect(Index: Integer): TRectF | Returns the panel rectangle at the given index. |
Events
Event name | Description |
---|---|
OnAfterDrawPanel | Event called after drawing a panel item. |
OnAnchorClick | Event called when an anchor is clicked. |
OnBeforeDrawPanel | Event called before drawing a panel item. |
OnDrawCustomPanel | Event called when drawing a custom panel item. |
OnPanelLeftClick | Event called when a panel item is clicked with the left mouse button. |
OnPanelRightClick | Event called when a panel item is clicked with the right mouse button. |