在触发creatsl事件时想把stringgrid的OnDrawCell事件发生但是编译通不过,希望高手们把他改正。procedure TStore.creatsl;
begin
sgname.OnDrawCell:=sgrowcolor;
end;procedure TStore.sgrowcolor(ACol,ARow:Integer;Rect:TRect; State:TGridDrawState);
var
i:integer;
begin
for I := 0 to sgname.ColCount- 1 do begin
if arow =0 then
sgname.Canvas.Brush.Color:=clskyblue;
end;
sgname.Canvas.FillRect(Rect);
sgname.Canvas.TextOut(Rect.Left,Rect.Top,sgname.Cells[ACol,ARow]);
end;
begin
sgname.OnDrawCell:=sgrowcolor;
end;procedure TStore.sgrowcolor(ACol,ARow:Integer;Rect:TRect; State:TGridDrawState);
var
i:integer;
begin
for I := 0 to sgname.ColCount- 1 do begin
if arow =0 then
sgname.Canvas.Brush.Color:=clskyblue;
end;
sgname.Canvas.FillRect(Rect);
sgname.Canvas.TextOut(Rect.Left,Rect.Top,sgname.Cells[ACol,ARow]);
end;
begin
sgname.OnDrawCell:=sgrowcolor(//这里要有参数);
end; procedure TStore.sgrowcolor(ACol,ARow:Integer;Rect:TRect; State:TGridDrawState);
var
i:integer;
begin
for I := 0 to sgname.ColCount- 1 do begin
if arow =0 then
sgname.Canvas.Brush.Color:=clskyblue;
end;
sgname.Canvas.FillRect(Rect);
sgname.Canvas.TextOut(Rect.Left,Rect.Top,sgname.Cells[ACol,ARow]);
end;
sgname.OnDrawCell:=sgrowcolor这里不用参数的
只要保证sgrowcolor的参数跟这个控件标准的OnDrawCell事件参数一样就行了。