stringgrid网格设置颜色问题?(100分)

  • 主题发起人 主题发起人 feigepan
  • 开始时间 开始时间
F

feigepan

Unregistered / Unconfirmed
GUEST, unregistred user!
只赋一个color不行,显示颜色不变,是否缺少其他语句,如重画?
 
你可以重画.,那样更好控制..
 
用第三方控件吧,那么麻麻干吗
 
我测试没有发现
procedure TForm1.Button1Click(Sender: TObject);
begin
StringGrid1.Color := clInfoBk;
end;
 
给个例子吧………希望能成功!
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
r:TRect;
d:TStringGrid;
begin
if (ACol=0) or (ARow=0) then exit;
r.top:=Rect.top-1;
r.left:=Rect.Left-1;
r.right:=Rect.right+1;
r.Bottom:=Rect.Bottom+1;
d:=TStringGrid(Sender);
d.Canvas.Pen.color:=clRed; //////////////////////////
d.Canvas.Brush.color:=clYellow;
d.Canvas.Font.color:=clBlue;
d.Canvas.Pen.width:=1;
d.canvas.Rectangle (r);
d.canvas.TextOut (r.left+2,r.top+2,d.cells[ACol,ARow]);
end;
 
同意楼上
 
同意楼上
 
如何动态调用StringGrid1DrawCell,使条件不同的格子颜色不同;
如果直接在其他函数里重画,r:TRect该取什么值?
 
后退
顶部