报表处理组件 BY DELPHI(3)

2008-04-10 02:58:27来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


begin
Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(S), Length(S), TempExtent);
if TempExtent.CX < MaxExtent then Break
else SetLogicFont(I,0);
end;

end;
end;
tcCalcRect:
begin
Texts.Text := AText;
case Direction of
tdVertChinese:
begin
TempStr := WideString(Texts[0]);
for I := 1 to Texts.Count - 1 do
begin
if Length(TempStr) < Length(WideString(Texts[I])) then
TempStr := WideString(Texts[I]);
end;
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
ARect.Bottom := ARect.Top Length(TempStr) * TextMetric.tmHeight;
end;
0:{Horizontal}
begin
J := 0;
for I := 0 to Texts.Count - 1 do
begin
Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent);
if J < TempExtent.CX then J := TempExtent.CX;
end;
ARect.Right := ARect.Left J;
end;
1..45,-45..-1:
begin
J := 0;
for I := 0 to Texts.Count - 1 do
begin
Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent);
if J < TempExtent.CX then J := TempExtent.CX;
end;
ARect.Right := ARect.Left Ceil(J*Scaler);
end;
46..90,-90..-46:
begin
J := 0;
for I := 0 to Texts.Count - 1 do
begin
Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent);
if J < TempExtent.CX then J := TempExtent.CX;
end;
ARect.Bottom := ARect.Top Ceil(J*Scaler);
end;
end;
end;
else Texts.Text := AText;
end;

{Initialize the origin point}
case Direction of
tdVertChinese:
begin
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
Interval := TextMetric.tmMaxCharWidth Windows.GetTextCharacterExtra(ACanvas.Handle);
J := Interval * Texts.Count;

if taLeft in Aligns then
X := ARect.Left J - Interval
else if taHorzCenter in Aligns then
X := (ARect.Right ARect.Left J) shr 1 - Interval
else {if taRight in Aligns}
X := ARect.Right - Interval;

Y := ARect.Top 2;
end;
0:{Horizontal}
begin
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
Interval := TextMetric.tmHeight;// TextMetric.tmExternalLeading;

J := Interval * Texts.Count;

X := ARect.Left 2;

if taBottom in Aligns then
Y := ARect.Bottom - J
else if taVertCenter in Aligns then
Y := (ARect.Bottom ARect.Top - J) shr 1
else {if taTop in Aligns then}
Y := ARect.Top 2;

end;
1..45:
begin
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
Interval := Ceil((TextMetric.tmHeight { TextMetric.tmExternalLeading})/Scaler);
J := Interval * Texts.Count;

X := ARect.Left 2;

if taBottom in Aligns then
Y := ARect.Bottom - J
else if taVertCenter in Aligns then
Y := (ARect.Bottom ARect.Top - J) shr 1
else {if taTop in Aligns then}
Y := ARect.Top 2;

end;
46..90:
begin
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
Interval := Ceil((TextMetric.tmHeight { TextMetric.tmExternalLeading})/Scaler);
J := Interval * Texts.Count;

if taRight in Aligns then
X := ARect.Right - J
else if taHorzCenter in Aligns then
X := (ARect.Right ARect.Left - J) shr 1
else {if taLeft in Aligns}
X := ARect.Left 2;

Y := ARect.Bottom - 2;

end;
-90..-46:
begin
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
Interval := Ceil((TextMetric.tmHeight{ TextMetric.tmExternalLeading})/Scaler);
J := Interval * Texts.Count;

if taLeft in Aligns then
X := ARect.Left J
else if taHorzCenter in Aligns then
X := (ARect.Right ARect.Left J) shr 1
else {if taRight in Aligns}
X := ARect.Right - 2;

Y := ARect.Top 2;
end;
-45..-1:
begin
Windows.GetTextMetrics(ACanvas.Handle,TextMetric);
Interval := Ceil((TextMetric.tmHeight{ TextMetric.tmExternalLeading})/Scaler);
J := Interval * Texts.Count;

X := ARect.Left 2;

if taBottom in Aligns then
Y := ARect.Bottom - J
else if taVertCenter in Aligns then
Y := (ARect.Bottom ARect.Top - J) shr 1
else {if taTop in Aligns then}
Y := ARect.Top 2;

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Delphi 程序员代码编写标准指南

下一篇:用DELPHI设计代理服务器程序