Un exemple :
procedure TFMain.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState); var ligne,d : integer; bRect : TRect; begin
ligne:=aRow-1+FMain.Grille_Up; if aRow>0 then If MenuI=3 then begin if copy(FMain.StringGrid1.Cells[0,aRow],1,1)='E' then begin //bleu 0FDC968; bleu pastel 00FFF3DD if (aRow mod 2)=0 then FMain.StringGrid1.Canvas.Brush.Color:=$0FDC968 else FMain.StringGrid1.Canvas.Brush.Color:=$00FFF3DD; end else begin //$00C6EEFF $0082DAFF if (aRow mod 2)=0 then FMain.StringGrid1.Canvas.Brush.Color:=$00C6EEFF else FMain.StringGrid1.Canvas.Brush.Color:=$0082DAFF; end; FMain.StringGrid1.Canvas.FillRect(aRect); if aCol=3 then begin d:=(FMain.StringGrid1.RowHeights[aRow]-13) div 2; bRect.Top:=aRect.Top+d; d:=(FMain.StringGrid1.ColWidths[aCol]-13)div 2; bRect.Left:=aRect.Left+d; if FMain.etat_pin[ligne]>=2 then FMain.StringGrid1.Canvas.Brush.Color:=clWhite; if FMain.etat_pin[ligne]=0 then begin FMain.StringGrid1.Canvas.Draw(bRect.Left,bRect.Top,ledverteoff); end; if FMain.etat_pin[ligne]=1 then begin FMain.StringGrid1.Canvas.Draw(bRect.Left,bRect.Top,ledverteon); end; end else if aCol=4 then begin d:=(FMain.StringGrid1.RowHeights[aRow]-13) div 2; bRect.Top:=aRect.Top+d; d:=(FMain.StringGrid1.ColWidths[aCol]-13)div 2; bRect.Left:=aRect.Left+d; if FMain.defaut_pin[ligne]=0 then begin FMain.StringGrid1.Canvas.Draw(bRect.Left,bRect.Top,ledrougeoff); end; if FMain.defaut_pin[ligne]=1 then begin FMain.StringGrid1.Canvas.Draw(bRect.Left,bRect.Top,ledrougeon); end; end else FMain.StringGrid1.Canvas.Brush.Color:=clWhite; end else begin FMain.StringGrid1.Canvas.Brush.Color:=clWhite; FMain.StringGrid1.Canvas.FillRect(aRect); end;
end;
Oniria
|