Board index » delphi » Possible to change cells font in a StringGrid ?

Possible to change cells font in a StringGrid ?

Is it possible to change the font used on cell per cell
basis in a StringGrid ?

--
-----------amities----------------Yves-----------regards---------
http://wwwperso.hol.fr/~bruan000        mailto:yves.bru...@hol.fr      
Yves BRUANT 234 rue Championnet 75018 PARIS  +33 (0)1 42 29 67 92

 

Re:Possible to change cells font in a StringGrid ?


Yes!

Capture the OnDrawCell event and draw the cell yourself using the
properties of TCanvas.

example

// clear the cell
(sender as TStringGrid).Canvas.FillRect(Rect) ;

// draw some stuff in the cell
(sender as TStringGrid).Canvas.Font.Name := whatever font you want
(tscreen.fonts) ;
(sender as TStringGrid).Canvas.TextOut(Rect.Left,Rect.Top, YourText) ;

fwiw
Charles Lam

Other Threads