|
发表于 2012-5-20 22:57:36
|
显示全部楼层
标题不会居中也要售1鱼币?我帮你解决
procedure TForm1.TableDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
const
AlignFlags:array[TAlignment] of integer=
(DT_LEFT oR DT_VCENTER OR DT_WORDBREAK OR DT_EXPANDTABS OR DT_NOPREFIX,
DT_RIGHT OR DT_VCENTER OR DT_WORDBREAK OR DT_EXPANDTABS OR DT_NOPREFIX,
DT_CENTER OR DT_VCENTER OR DT_WORDBREAK OR DT_EXPANDTABS OR DT_NOPREFIX);
var
s:string;
begin
inherited;
with Rect do
begin
left:=left+2;
top:=top+2;
Right:=right-5;
end;
s:=Table.Cells[acol,arow];
if ((acol=0) and (arow<=table.RowCount)) or ((acol<=table.ColCount) and (arow=0)) then
begin
Table.Canvas.Font.Style:=Table.Canvas.Font.Style+[fsbold];
Table.Canvas.Brush.Color:=Table.FixedColor;
Table.Canvas.FillRect(rect);
Drawtext(Table.Canvas.Handle,pchar(s),length(s),rect,AlignFlags[taCenter]);
end
else
//if (acol=0 ) and (arow> 0) and (arow < Table.RowCount) then
begin
Table.Canvas.FillRect(rect);
Drawtext(Table.Canvas.Handle,PChar(s),length(s),Rect,AlignFlags[taRightJustify]);
end; |
|