我想判断如果stringgrid中某个单元格的值大于10则让这个单元格颜色变成红色,请问如何实现,请给代码。
解决方案 »
- TIdTCPServer向TIdTCPClient传输文件难道不行吗?多行数据库记录向TIdTCPServer发送难道只有以文件的形式(如*.xml等格式)发送最好吗?
- 关于窗口消失的问题
- 在dll中能否把數據集作參數進行傳送?
- ActiveX 版本更新问题
- 求OICQ的通讯协议,急!(在线等)
- 怎样在连续打印报表时,每张报表的位置都非常正确?
- 大家英文好的过来帮我看一段。。。高分相送。。。在线等待。。。
- 在运行状态下如何找出一个类有哪些方法?
- 关于利息每天自动计算实现
- 怎样求一个随机数,它是1至24内的任一整数?
- PC串口连手机模块发送短信(用MSComm控件)给分100
- 什么地方可以买到Borland Delphi 2005的产品介绍的书?
Rect: TRect; State: TGridDrawState);
begin
if (stringgrid1.Cells[acol,arow] <> '') and (strtoint(stringgrid1.Cells[acol,arow]) > 0) then
begin
stringgrid1.Canvas.Brush.Color:= clRed;
stringgrid1.Canvas.FillRect(rect);
end;
end;
Rect: TRect; State: TGridDrawState);
begin
try
if trim(StringGrid1.Cells[Acol,Arow])<>'' then
if StrToint(StringGrid1.Cells[Acol,Arow])>10 then
begin
StringGrid1.Canvas.Brush.Color:=clred;
StringGrid1.Canvas.TextRect(Rect,Rect.Left,Rect.Top,StringGrid1.Cells[Acol,Arow]);
end;
except;
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if (stringgrid1.Cells[acol,arow] <> '') and (strtoint(stringgrid1.Cells[acol,arow]) > 0) then
begin
stringgrid1.Canvas.Brush.Color:= clRed;
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.TextOut(rect.Left+1,rect.Top+5,stringgrid1.Cells[acol,arow]);
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if (stringgrid1.Cells[acol,arow] <> '') and (strtoint(stringgrid1.Cells[acol,arow]) > 10) then
begin
stringgrid1.Canvas.Brush.Color:= clRed;
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.TextOut(rect.Left+1,rect.Top+5,stringgrid1.Cells[acol,arow]);
end;
end;
Rect: TRect; State: TGridDrawState);
var TextB : String;
begin
TextA := stringgrid1.Cells[ACol,ARow];
if TextA = '' then
begin
stringgrid1.Canvas.Brush.Color := $00F5F5F5;
stringgrid1.Canvas.FillRect(Rect);
end else if TextA > '10' then
begin
stringgrid1.Canvas.Brush.Color:= clRed;
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.TextOut(rect.Left+1,rect.Top+5,stringgrid1.Cells[acol,arow]);
end;
end