报表处理组件 BY DELPHI(3)
2008-04-10 02:58:27来源:互联网 阅读 ()
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设计代理服务器程序
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
