Draw in TStatusBar

Posted in Components

Do not forget to set Style property of the StatusBar1.Panels to psOwnerDraw. Just write an OnDrawPanel event handler for the StatusBar like this:

procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
  Panel: TStatusPanel; const Rect: TRect);
var
  BitMap: TBitMap;
begin
  Bitmap:=TBitmap.Create;
  Bitmap.LoadFromFile('Factory.bmp');
  with StatusBar1.Canvas,Rect do 
  begin
    Brush.Color:=clRed;
    FillRect(Rect);
    Draw(Succ(Left),Succ(Top),BitMap);
  end;
end;