我想让stringgrid指定列显示指定颜色,我写了如下程序段
procedure Tfrm_luru.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
inherited;
if not((acol=1) and (arow>=cp.fixedrows)) then exit;
with stringgrid1 do
begin
stringgrid1.Canvas.Brush.color:=clRed;
stringgrid1.canvas.FillRect(Rect);
stringgrid1.canvas.TextOut(rect.left+2,rect.top+2,stringgrid1.cells[acol,arow]); end;
end;
可系统老是提示我有非法字符,
[Error] luru.pas(667): Illegal character in input file: ' ' ($A1A1)
什么原因?
procedure Tfrm_luru.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
inherited;
if not((acol=1) and (arow>=cp.fixedrows)) then exit;
with stringgrid1 do
begin
stringgrid1.Canvas.Brush.color:=clRed;
stringgrid1.canvas.FillRect(Rect);
stringgrid1.canvas.TextOut(rect.left+2,rect.top+2,stringgrid1.cells[acol,arow]); end;
end;
可系统老是提示我有非法字符,
[Error] luru.pas(667): Illegal character in input file: ' ' ($A1A1)
什么原因?
解决方案 »
- 如何实现图片居中(总是在屏幕的中间)?
- Borland中国 调查贴
- 这段程序好像是到时响铃的能解释一下吗
- 关于Filter的问题
- 政府的软件要用国标,那位有这些代码? 干部职务名称代码,疾病分类与代码,?谁有阿?
- 谁能告诉我,用BDE还是ADO?
- 请问我要这样记录删除怎样可以实现啊?
- 怎么将多个表中的数据加总(其中有Master/Detail表)
- 这是有关internetexpress控件的问题,给100分!
- mscomm在delphi里面怎么用呀???
- 如何用程序代码为TImageList控件添加图标
- 为了使Tedit在获取/失去焦点时改其背景色,特地做了个派新类Tedit1,但却达不到效果.请看一下源码...
在OnDrawCell事件中处理背景色。程序如下:
//将第二列背景变为红色。
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if not((acol=1) and (arow>=stringgrid1.fixedrows)) then exit;
with stringgrid1 do
begin
canvas.Brush.color:=clRed;
canvas.FillRect(Rect);
canvas.TextOut(rect.left+2,rect.top+2,cells[acol,arow])
end;
end;