procedure TForm1.Grid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if (grid1.Cells[acol,arow]='hello') and (arow<>0) then
imageList1.Draw(grid1.canvas,rect.left,rect.top,1)
else
imageList1.Draw(grid1.canvas,rect.left,rect.top,0);end;这是我刚做的一个例子,记住要声明imagelist.这个例子目的是在表格内显示
0号小图标。如果这个表格的内容是hello,则显示1号图标
Rect: TRect; State: TGridDrawState);
begin
if (grid1.Cells[acol,arow]='hello') and (arow<>0) then
imageList1.Draw(grid1.canvas,rect.left,rect.top,1)
else
imageList1.Draw(grid1.canvas,rect.left,rect.top,0);end;这是我刚做的一个例子,记住要声明imagelist.这个例子目的是在表格内显示
0号小图标。如果这个表格的内容是hello,则显示1号图标
Rect: TRect; State: TGridDrawState);
begin
if (StringGrid1.Cells[acol,arow]='FValue') and (arow<>0) then
StringGrid1.Canvas.TextOut(Rect.Left,Rect.Top,'OK'); end;