TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Wallpaper = new Graphics::TBitmap;
Wallpaper->LoadFromFile("c:\\image.bmp");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol, int ARow,
TRect &Rect, TGridDrawState State) /* Zdarzenie OnDrawCell */
{
/* warunek pomija komórki nagłówka */
if(ACol > 0 && ARow > 0)
{
StringGrid1->Canvas->CopyRect(Rect, Wallpaper->Canvas, Rect); // wypełnienie komórek tłem
//ponowne wypełnienie komórek tekstem
StringGrid1->Canvas->Brush->Style = bsClear;
String Text = StringGrid1->Cells[ACol][ARow];
int j = (Rect.Bottom - Rect.Top - StringGrid1->Canvas->TextHeight(Text))/2;
StringGrid1->Canvas->TextOut(Rect.Left + 2, Rect.Top + j, Text);
}
}
//---------------------------------------------------------------------------