需求:将单元格从文本变为下拉列表,并修改单元格颜色
procedure MyForm.MyEditExit(Sender: TObject);
var
I, J: Integer;
CellProperties: TCellProperties;
begin
inherited;
for I := 1 to AdvStringGrid.RowCount - 1 do
begin
CellProperties := AdvStringGrid.GetCellProperties(7, I);
if IntToStr(AdvStringGrid.Cells[7,I]) <= MyEdit.Val then
begin
AdvStringGrid.Cells[7, I] := '否';
CellProperties.FontColor := clSilver;
end
else
begin
CellProperties.Editor := edComboList;
AdvStringGrid.ClearComboString;
AdvStringGrid.Combobox.Items.Add('否');
AdvStringGrid.Combobox.Items.Add('是');
CellProperties.FontColor := clWindowText;
end;
end;
end;