C++Builder Logo
How to draw a bitmap on a StatusBar Comment afficher un bitmap dans un StatusBar

Here is how to draw a bitmap on a StatusBar. Place a StatusBar on your form. Select a panel and give it the ownerdraw style and add the code below in the OnPanelDraw event of the StatusBar. Placez un StatusBar sur votre form. Sélectionnez un panel et donnez-lui le style ownerdraw. Ajoutez le code ci-dessous dans l'évènement OnPanelDraw du StatusBar.

 
void __fastcall TForm1::StatusBar1DrawPanel(TStatusBar *StatusBar, 
    TStatusPanel *Panel, const TRect &Rect) 

  if(Panel->Index==0)   //Change this line if you want another panel 
  { 
    Graphics::TBitmap *tmpBitmap=new Graphics::TBitmap(); 
    tmpBitmap->LoadFromFile("bac.bmp"); 
    StatusBar->Canvas->Draw(Rect.Left,Rect.Top,tmpBitmap); 
    delete tmpBitmap; 
  } 
}