在用ehlib3.6打印功能时,如何设置PrintDBGridEh中Title字体的大小呀? ( 积分: 50 )

  • 主题发起人 主题发起人 lifndcw
  • 开始时间 开始时间
L

lifndcw

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure PrintGridTitleTextHeight(FromCol, ToCol: Integer);
var r: TRect;
i, lm, rm, tm: Integer;
begin
r := Rect(DataPrintRec.Left, DataPrintRec.Top - PrnTitlEh - PrnTitleTextH + PrintOffset, DataPrintRec.Left, DataPrintRec.Top - PrnTitlEh + PrintOffset);
for i := FromCol to ToColdo
Inc(r.Right, Integer(PrnColWidths));
if (Title.Text <> '') then
begin
VPrinter_Canvas.Font := DBGridEh.TitleFont;
if (PrintFontName <> '') then
VPrinter_Canvas.Font.Name := PrintFontName;
r := Rect(DataPrintRec.Left, DataPrintRec.Top - PrnTitlEh - PrnTitleTextH + PrintOffset, r.Right, DataPrintRec.Top - PrnTitlEh + PrintOffset);
lm := PSX2;
// if FromCol = 0 then
lm := PSX2 else
lm := 0;
rm := PSX2;
//if ToCol = DBGridEh.VisibleColumns.Count-1 then
rm := PSX2 else
rm := 0;
for i := 0 to FromCol - 1do
Dec(lm, Integer(PrnColWidths));
for i := ToCol + 1 to PrnColumns.Count - 1do
Dec(rm, Integer(PrnColWidths));
if DBGridEh.UseMultiTitle
then
tm := Round(DBGridEh.VTitleMargin * fScaleY / 2) else
tm := PSY2;
if pghColored in Options
then
VPrinter_Canvas.Brush.Color := DBGridEh.FixedColor;
if DBGridEh.UseRightToLeftAlignment then
OffsetRect(r, (DataPrintRec.Right + DataPrintRec.Left) - (r.Left + r.Right), 0);

WriteTextEh(VPrinter_Canvas, r, pghColored in Options, 0, tm, GetStingListText(Title),
taCenter, tlTop, True, False, lm, rm, CalcInfoMode,
DBGridEh.UseRightToLeftAlignment, DBGridEh.UseRightToLeftReading);
AddPolyline([r.Left, r.Bottom, r.Left, r.Top, r.Right, r.Top, r.Right, r.Bottom]);
end;
end;
 
procedure PrintGridTitleTextHeight(FromCol, ToCol: Integer);
var r: TRect;
i, lm, rm, tm: Integer;
begin
r := Rect(DataPrintRec.Left, DataPrintRec.Top - PrnTitlEh - PrnTitleTextH + PrintOffset, DataPrintRec.Left, DataPrintRec.Top - PrnTitlEh + PrintOffset);
for i := FromCol to ToColdo
Inc(r.Right, Integer(PrnColWidths));
if (Title.Text <> '') then
begin
VPrinter_Canvas.Font := DBGridEh.TitleFont;
if (PrintFontName <> '') then
VPrinter_Canvas.Font.Name := PrintFontName;
r := Rect(DataPrintRec.Left, DataPrintRec.Top - PrnTitlEh - PrnTitleTextH + PrintOffset, r.Right, DataPrintRec.Top - PrnTitlEh + PrintOffset);
lm := PSX2;
// if FromCol = 0 then
lm := PSX2 else
lm := 0;
rm := PSX2;
//if ToCol = DBGridEh.VisibleColumns.Count-1 then
rm := PSX2 else
rm := 0;
for i := 0 to FromCol - 1do
Dec(lm, Integer(PrnColWidths));
for i := ToCol + 1 to PrnColumns.Count - 1do
Dec(rm, Integer(PrnColWidths));
if DBGridEh.UseMultiTitle
then
tm := Round(DBGridEh.VTitleMargin * fScaleY / 2) else
tm := PSY2;
if pghColored in Options
then
VPrinter_Canvas.Brush.Color := DBGridEh.FixedColor;
if DBGridEh.UseRightToLeftAlignment then
OffsetRect(r, (DataPrintRec.Right + DataPrintRec.Left) - (r.Left + r.Right), 0);

WriteTextEh(VPrinter_Canvas, r, pghColored in Options, 0, tm, GetStingListText(Title),
taCenter, tlTop, True, False, lm, rm, CalcInfoMode,
DBGridEh.UseRightToLeftAlignment, DBGridEh.UseRightToLeftReading);
AddPolyline([r.Left, r.Bottom, r.Left, r.Top, r.Right, r.Top, r.Right, r.Bottom]);
end;
end;
 
没有人会吗?
 
在这里 VPrinter_Canvas.Font := DBGridEh.TitleFont;
增加 VPrinter_Canvas.Font.Size := 18;(填入你需要的字体大小)。
 
后退
顶部