请delphi高手指点!

来源:百度知道 编辑:UC知道 时间:2024/06/17 06:59:21
麻烦高手给下面语句一些解析,看的我头都大了,看不懂啊!多谢!!!!!

procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
index:integer;
begin
index:=arow*drawgrid1.ColCount+acol;
with sender as tdrawgrid do
begin
canvas.brush.Color:=clcream;
canvas.FillRect(rect);
imagelist1.Draw(canvas,rect.left+1,rect.top+5,index);
if gdfocused in state then
canvas.DrawFocusRect(rect);
end;

end;

imagelist1.Draw(canvas,rect.left+1,rect.top+5,index);

这个是你在imagelist中定义好的BMP或ICO图集之后,把INTEX的ICO或BMP画在指定在表格的表头上.

其余的语句是在程序绘制你的表格的时候,自动把表中的每一单元格用白色画矩形填充.并且让单元格失去焦点.

它画啊画
它画啊画