TStringGrid + GRAS

cs_vagabon Messages postés 31 Date d'inscription lundi 4 novembre 2002 Statut Membre Dernière intervention 13 juin 2003 - 11 juin 2003 à 22:47
NetCyrille Messages postés 14 Date d'inscription lundi 4 novembre 2002 Statut Membre Dernière intervention 13 juin 2003 - 13 juin 2003 à 08:03
Bonjour,

Je voudrais mettre une cellule de mon Tableau (TStringGrid) en Gras, est ce que vous pouvez me dire comment faire ?

Merci d'avance

2 réponses

cs_ManChesTer Messages postés 374 Date d'inscription vendredi 20 octobre 2000 Statut Modérateur Dernière intervention 15 janvier 2021
13 juin 2003 à 00:33
Bon voila ...

1. Met la propriètè DefaultDrawing de ton Stringrid sur false

2. Insere le code suivant dans l'Evénement OnDrawCell:

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with StringGrid1.canvas do
begin
if (Acol=0) or (Arow=0) then // si on dessine sur la colonne ou la rangée 0
Brush.color:=StringGrid1.FixedColor // definis la couleur de fond
else // sinon
Brush.color:=StringGrid1.Color; // definis la couleur de fond (Blanc par default)
Fillrect(rect);
Font.Style:=Font.Style+[Fsbold];
TextOut(Rect.Left,rect.Top+(Textheight(StringGrid1.Cells[ACol,ARow]) div 2),StringGrid1.Cells[ACol,ARow]);
end;
end;

Bon Coding ....

ManChesTer.
0
NetCyrille Messages postés 14 Date d'inscription lundi 4 novembre 2002 Statut Membre Dernière intervention 13 juin 2003
13 juin 2003 à 08:03
Merci beaucoup.

Vag
0
Rejoignez-nous