procedure TMainForm.MailListDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if gdSelected in State then LastColor := ClBlue
else if DataCol = 0 then
begin
if Column.Field.AsInteger = 101 then LastColor := clYellow
else if Column.Field.AsInteger = 107 then LastColor := clWhite
else LastColor := clGreen;
end;
procedure TxRxDBGrid.GetCellProps(Field: TField; AFont: TFont; var Background: TColor;
Highlight: Boolean);
begin
if FRowColorsUse and not Highlight then
Background := FRowColors[DataLink.ActiveRecord mod 2];
inherited;
end;
procedure TxRxDBGrid.KeyDown(var Key: Word; Shift: TShiftState);
begin
inherited;
if ((Key = VK_NEXT) and not DataLink.DataSet.EOF)
or ((Key = VK_PRIOR) and not DataLink.DataSet.BOF) then
Invalidate;
end;
procedure TxRxDBGrid.Scroll(Distance: Integer);
begin
Invalidate;
inherited;
end;
procedure TxRxDBGrid.SetRowColorsUse(Value: Boolean);
begin
if FRowColorsUse <> Value then
begin
FRowColorsUse := Value;
Invalidate;
end;
end;
procedure TxRxDBGrid.SetRowColor(Index: Integer; Value: TColor);
begin
if FRowColors[Index] <> Value then
begin
FRowColors[Index] := Value;
if FRowColorsUse then Invalidate;
end;
end;
procedure Register;
begin
RegisterComponents('Data Controls', [TxRxDBGrid]);
end;