|
<< Click to Display Table of Contents >> Navigation: Forum > Managing text Color in IWDBGrid |
01-09-2021, 04:36 PM:
Below is the procedure for processing the onRendercell event of the dgMessage component (TIWDBGrid).
Problem:
ACell.BGColor := clWebLIGHTBLUE - works,
ACell.Font.Color := clWebGreen; does not work.
The background color changes, but the text color does not change.
procedure TfmVmMain.dgMessageRenderCell(ACell: TIWGridCell; const ARow,
AColumn: Integer);
begin
with dmVM do
begin
case dmVM.mtMessage.FieldByName('TYPE_REC').AsInteger of dmVM.mtMessage.Fieldbyname ('TYPE_REC').AsInteger of
0 : ACell.Font.Color := clWebBLACK;
1 : ACell.Font.Color := clWebNavy; // TextFont.????: = clWebNavy; / / ?????
2 : ACell.Font.Color := clWebGreen; // Header 1Font.???? := clWebGreen; / / ????????? 1
3 : ACell.Font.Color := clWebMaroon; // Header 2Font.Color := clWebMaroon; / / ????????? 2
end;
if dgMessage.RowIsCurrent then
begin
mCurrentMID := mtMessage.FieldByName('MID').AsString;
ACell.BGColor := clWebLIGHTBLUE;//clWebWHITE;
end else begin
ACell.BGColor := clWebGAINSBORO;// clMoneyGreen;// clWebWHITE;
end;
end;
end;
Tell me what is wrong?
01-18-2021, 01:49 PM:
I will formulate the question more compactly :
procedure TfmVmMain.dgMessageRenderCell(ACell: TIWGridCell; const ARow, AColumn: Integer);
begin
if dgMessage.RowIsCurrent then
begin
ACell.Font.Color := clWebMaroon; // The color is not assigned!
ACell.BGColor := clWebLIGHTBLUE; // The color is assigned, everything works as it should.
end else begin
ACell.Font.Color := clBlack; // The color is not assigned!
ACell.BGColor := clWebGAINSBORO; // The color is assigned, everything works as it should.
end;
end;
If you are using DbGrid a similar approach to the coloring of the lines is working.
Am I doing something wrong or is it not working properly IWDBGrid ?