to:redsky.l,
不行,我用stringgrid(不是AligridString)自定义draw过程(过程如下),但当
strigngrid上面 的showmodual窗体移动时,
stringgrid.OnDrawCell事件触发,stringrid又变成空白,
如果设defaultdraw:=false,则showmodual窗体移动时,会把移到的cell数据清除。
还请指教!
过程如下:with StringGrid do
begin
for iCol:=1 to ColCount do
for iRow:=1 to RowCount do
begin
if ADOQryHouse.Locate('sHouseID',(FormatFloat('00',iCol)+FormatFloat('00',iRow)),[]) then
begin
if Trim(ADOQryHouse.FieldByName('sSellState').AsString)='预定' then Canvas.Brush.Color := clFuchsia;
if (Trim(ADOQryHouse.FieldByName('sSellState').AsString)='已售') or (Trim(ADOQryHouse.FieldByName('sSellState').AsString)='已签') then Canvas.Brush.Color := clRed;
if Trim(ADOQryHouse.FieldByName('sSellState').AsString)='未售' then Canvas.Brush.Color := clWindow;
if ADOQryHouse.FieldByName('bRetainState').AsBoolean then Canvas.Brush.Color := clLime;
Canvas.FillRect(CellRect(iCol,iRow));
Canvas.TextOut(CellRect(iCol,iRow).Left + 2, CellRect(iCol,iRow).Top + 2, ADOQryHouse.FieldByName('sHouseID').AsString);
end;
end;
end;