写OnDrawCell事件,改变字体即可。
解决方案 »
- delphi连接oracle数据库怎么日期语句保存不进去???在线等待
- 各位来看下这是啥意思呢?
- DELPHI程序中,注释是否会被编译进EXE文件?
- 请问在调用存储过程后如何获得返回的记录集?
- quickreport报表中可否加两个rbdetail类型的band?
- 怎样使控件大小随着窗口大小变化而成比例的变化?
- 关于Delphi执行存储过程时,进度条显示
- 考程序员
- dxBarManager style 问题
- 在VB里ADO有个属性当记录指针EOF的时候选择是否增加,或者指针停在记录尾。。。。
- BORLAND的活动的邀请函
- 在delphi里面怎么对一个45位的整型数进行运算啊(div mod等)?
Rect: TRect; State: TGridDrawState);
begin
//根据不同的单元格设置不同的字体
if Acol=2 then
with StringGrid1 do
begin
Canvas.Font.Color := clred;
Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol,ARow]);
end;
//...其他限制条件
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
{根据单元格内值的不同设置不同的字体}
with StringGrid1 do
if Cells[ACol,ARow]<>'' then
if StrToFloat(Cells[ACol,ARow])>10 then //其实这里你可以具体到某一列或某一行
begin
Canvas.Font.Color := clred;
Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[ACol,ARow]);
end;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.Cells[random(10),random(10)] := FormatFloat('0.00',random(100)/5);
end;
是正解