求教,AdvStringGrid从数据库读出指定数据的那行变色.
一个服务器系统,一个客户端系统. 我从数据库里查询在服务器系统中指定的字段,把字段加入xml文件中.然后把xml文件中的值加入array中,然后客户端系统中的AdvStringGrid从array里读取字段做表头.有一个字段假定为ID,我想把AdvStringGrid中ID值为3的一行的颜色设置成蓝色的,可以实现吗?求高手.
[解决办法]
他不是有自画的Draw相关的事件吗,在那给id=3的那行画底色
[解决办法]
- Delphi(Pascal) code
procedure TForm1.AdvStringGridDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);var s: string;begin with AdvStringGriddo begin s := Cells[2, ARow]; {ID在第3行即是2(从0行开始数)} if s='3' then begin Canvas.Font.Color := clBlack; Canvas.Brush.Color := clRed; Canvas.FillRect(Rect); Canvas.TextOut(Rect.Left+3, Rect.top+3, s); end; end;end;