C
chen11
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure title_sg_wy(sg: tstringgrid; title: string); //此函数仅用于为 STRING GRID 第一行命名标题
var
i, len, posi, s_len, j, k: integer;
til: string;
begin
i := 0;
len := length(title);
with sg do
begin
colcount := 100;
rowcount := 2;
Fixedrows := 1;
while (len > 0) do
begin
posi := pos('*', title);
til := copy(title, 1, posi - 1);
len := len - posi;
title := copy(title, posi + 1, len);
posi := pos('*', title);
if title[posi-1]='' then exit else
s_len := strtoint(copy(title, 1, posi - 1));
ColWidths := floor(s_len * 6.5);
len := len - posi;
title := copy(title, posi + 1, len);
j := (s_len - length(til)) div 2;
for k := 1 to j do
til := ' ' + til;
cells[i, 0] := til;
inc(i);
end;
ColCount := i;
for i := 0 to colcount + 2 do
cells[i, 1] := '';
end;
end;
var
i, len, posi, s_len, j, k: integer;
til: string;
begin
i := 0;
len := length(title);
with sg do
begin
colcount := 100;
rowcount := 2;
Fixedrows := 1;
while (len > 0) do
begin
posi := pos('*', title);
til := copy(title, 1, posi - 1);
len := len - posi;
title := copy(title, posi + 1, len);
posi := pos('*', title);
if title[posi-1]='' then exit else
s_len := strtoint(copy(title, 1, posi - 1));
ColWidths := floor(s_len * 6.5);
len := len - posi;
title := copy(title, posi + 1, len);
j := (s_len - length(til)) div 2;
for k := 1 to j do
til := ' ' + til;
cells[i, 0] := til;
inc(i);
end;
ColCount := i;
for i := 0 to colcount + 2 do
cells[i, 1] := '';
end;
end;