procedure TfrmPrescripcionDieteticaInicial.stgProcesarDrawCell(Sender: TObject; ACol, ARow: Integer; TheRect: TRect; State: TGridDrawState);
function ExisteEnTitulo(sTexto: string): Boolean;
var
iIndicador: Integer;
begin
Result := False;
for iIndicador := 0 to Length(aTextoColor)-1 do
begin
if Trim(aTextoColor[iIndicador,TEXTOCELDA]) = Trim(sTexto) then
begin
Result := True;
Break;
end;
end;
end;
var
aColores: Variant;
begin
with Sender as TStringGrid do
begin
if (ACol = 3) and (ARow = 2) and (Trim(Cells[03,02]) > '') then
begin
Canvas.Brush.Color := clRed;
Canvas.FillRect(TheRect);
Canvas.Font.Color := clYellow;
Canvas.TextOut(TheRect.Left + 2, TheRect.Top + 2, Cells[ACol, ARow]);
end;
if Trim(Cells[ACol, ARow]) = '¤' then
begin
Canvas.Brush.Color := clGreen;
Canvas.FillRect(TheRect);
Canvas.Font.Color := clWhite;
Canvas.TextOut(TheRect.Left + 2, TheRect.Top + 2, Cells[ACol, ARow]);
end;
if (ACol = 1) and (ARow = 2) then
begin
with TheRect do
begin
Left := ColWidths[00]+GridLineWidth;
Top := (RowHeights[ARow]*ARow)+(GridLineWidth*ARow);
Right := ColWidths[00]+ColWidths[01]+ColWidths[02]+GridLineWidth;
Bottom := (RowHeights[ARow]*(ARow+1))+(GridLineWidth*ARow);
end;
Canvas.Brush.Color := clWhite;
Canvas.FillRect(TheRect);
Canvas.Font.Color := clWindowText;
Canvas.TextRect(TheRect, TheRect.Left+2, TheRect.Top+2, '');
end;
if Trim(Cells[ACol,ARow]) > '' then
begin
if Cells[ACol,ARow] = '·' then
begin
aColores := GetColores('Sobrepeso');
with TheRect do
begin
Left := ColWidths[00]+ColWidths[01]+GridLineWidth;
Top := (RowHeights[ARow]*ARow)+(GridLineWidth*ARow);
Right := ColWidths[00]+ColWidths[01]+ColWidths[02]+GridLineWidth;
Bottom := (RowHeights[ARow]*(ARow+1))+(GridLineWidth*ARow);
end;
Canvas.Brush.Color := StringToColor(aColores[COLORLIENZO]);
Canvas.FillRect(TheRect);
Canvas.Font.Color := StringToColor(aColores[COLORFUENTE]);
Canvas.TextRect(TheRect, TheRect.Left+2, TheRect.Top+2, '');
end;
if Cells[ACol,ARow] = '_' then
begin
aColores := GetColores(Cells[ACol-1,ARow]);
with TheRect do
begin
Left := ColWidths[00]+ColWidths[01]+GridLineWidth;
Top := (RowHeights[ARow]*ARow)+(GridLineWidth*ARow);
Right := ColWidths[00]+ColWidths[01]+ColWidths[02]+GridLineWidth;
Bottom := (RowHeights[ARow]*(ARow+1))+(GridLineWidth*ARow);
end;
Canvas.Brush.Color := StringToColor(aColores[COLORLIENZO]);
Canvas.FillRect(TheRect);
Canvas.Font.Color := StringToColor(aColores[COLORFUENTE]);
Canvas.TextRect(TheRect, TheRect.Left+2, TheRect.Top+2, '');
end;
if ExisteEnTitulo(Trim(Cells[ACol,ARow])) then
begin
if Trim(Cells[ACol,ARow]) > '' then
begin
aColores := GetColores(Trim(Cells[ACol,ARow]));
Canvas.Brush.Color := StringToColor(aColores[COLORLIENZO]);
Canvas.FillRect(TheRect);
Canvas.Font.Color := StringToColor(aColores[COLORFUENTE]);
Canvas.TextOut(TheRect.Left + 2, TheRect.Top + 2, Cells[ACol, ARow]);
end;
end else begin
if Cells[00,ARow] = 'I. M. C.' then
begin
with TheRect do
begin
Left := 1;
Top := 0;
Right := ColWidths[00]-GridLineWidth;
Bottom := (RowHeights[ARow]*3)-GridLineWidth;
end;
Canvas.Brush.Color := clWhite;
Canvas.FillRect(TheRect);
Canvas.Font.Color := clWindowText;
Canvas.TextRect(TheRect, TheRect.Left+2, TheRect.Top+2, Cells[00,ARow]);
end;
if Cells[01,ARow] = 'Clasificacion de' then
begin
with TheRect do
begin
Left := ColWidths[00]+GridLineWidth;
Top := (RowHeights[ARow]*ARow)+(GridLineWidth*ARow);
Right := ColWidths[00]+ColWidths[01]+ColWidths[02]+GridLineWidth;
Bottom := (RowHeights[ARow]*(ARow+1))+(GridLineWidth*ARow);
end;
Canvas.Brush.Color := clWhite;
Canvas.FillRect(TheRect);
Canvas.Font.Color := clWindowText;
Canvas.TextRect(TheRect, TheRect.Left+2, TheRect.Top+2, Cells[01,ARow]);
end;
if Cells[01,ARow] = 'Riesgos Nutricionales' then
begin
with TheRect do
begin
Left := ColWidths[00]+GridLineWidth;
Top := (RowHeights[ARow]*ARow)+(GridLineWidth*ARow);
Right := ColWidths[00]+ColWidths[01]+ColWidths[02]+GridLineWidth;
Bottom := (RowHeights[ARow]*(ARow+1))+(GridLineWidth*ARow);
end;
Canvas.Brush.Color := clWhite;
Canvas.FillRect(TheRect);
Canvas.Font.Color := clWindowText;
Canvas.TextRect(TheRect, TheRect.Left+2, TheRect.Top+2, Cells[01,ARow]);
end;
end;
end;
end;
end;