quick report delphi
场景:
Quick.Report.Pro.v4.07.Delphi.2007 打印预览汉化问题
我在Delphi 2007 下使用 Quick.Report.Pro.v4.07.Delphi.2007。
现打算把打印预览窗体中的显示信息改为中文, qrprev.dfm qrprev.pas
我把按钮英文提法改为中文后,编译包,把.bpl .dcp 分发到 ..\CodeGear\RAD Studio\5.0\\bin 以及 \CodeGear\RAD Studio\5.0\QuickRep\bpl 下,
可重新Build原来的工程后,预览窗体中的按钮提示信息仍然是英文。
请问如何解决?
------解决方案--------------------
编译后,找到bpl再手动安装QuickReport
------解决方案--------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, QuickRpt, QRCtrls, ExtCtrls,ToolWin,
ComCtrls, Buttons;
type
TForm2 = class(TForm)
QuickRep: TQuickRep;
QRDBText1: TQRDBText;
QRLabel1: TQRLabel;
QRBand1: TQRBand;
QRLabel2: TQRLabel;
QRDBText2: TQRDBText;
ADODataSet1: TADODataSet;
procedure QuickRepBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
{ Private declarations }
public
{ Public declarations }
procedure DoPrint();
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
//QuickRep 汉化的函数
procedure g_InitQuickRpt(const QuickRpt: TQuickRep);
var
i,j: integer;
fmPreview: TForm;
tBar, tButton: TComponent;
begin
if (QuickRpt.QRPrinter.Client=nil) or
(not (QuickRpt.QRPrinter.Client.Parent is TForm)) then Exit;
fmPreview := TForm(QuickRpt.QRPrinter.Client.Parent);
for i := 0 to fmPreview.ControlCount - 1 do
begin
tBar := fmPreview.Controls[i];
if tBar is TToolbar then
begin
for j := 0 to TToolBar(tBar).ControlCount - 1 do
begin
tButton := TToolBar(tBar).Controls[j];
//汉化工具栏的 TToolButton 按钮
if tButton is TToolButton then
begin
//根据tButton.Name作汉化。
if LowerCase(tButton.Name)='zoomfit' then TToolButton(tButton).Hint := '适合整页';
if LowerCase(tButton.Name)='zoom100' then TToolButton(tButton).Hint := '原始比例';
if LowerCase(tButton.Name)='zoomtowidth' then TToolButton(tButton).Hint := '适合页宽';
if LowerCase(tButton.Name)='firstpage' then TToolButton(tButton).Hint := '首页';
if LowerCase(tButton.Name)='previouspage' then TToolButton(tButton).Hint := '上一页';
if LowerCase(tButton.Name)='toolbutton2' then TToolButton(tButton).Hint := '下一页';
if LowerCase(tButton.Name)='lastpage' then TToolButton(tButton).Hint := '末页';
if LowerCase(tButton.Name)='toolbutton3' then TToolButton(tButton).Hint := '跳转到';
if LowerCase(tButton.Name)='printsetup' then TToolButton(tButton).Hint := '打印设置';
if LowerCase(tButton.Name)='print' then TToolButton(tButton).Hint := '打印';
if LowerCase(tButton.Name)='savereport' then TToolButton(tButton).Hint := '保存报表';
if LowerCase(tButton.Name)='loadreport' then TToolButton(tButton).Hint := '打开报表';
end;
//汉化 TSpeedButton 按钮,好像就一个 Close 按钮。
if (tButton is TSpeedButton) then
begin
TSpeedButton(tButton).Font.Name := '宋体';
TSpeedButton(tButton).Font.Size := 9;
TSpeedButton(tButton).Hint := '关闭';
TSpeedButton(tButton).Caption := '关闭';
end;
end;
end;
end;
end;
procedure TForm2.DoPrint();
begin
QuickRep.Preview;
end;
procedure TForm2.QuickRepBeforePrint(Sender: TCustomQuickRep; var PrintReport: Boolean);
begin
//汉化工作.
g_InitQuickRpt(QuickRep);
end;
end.
Quick.Report.Pro.v4.07.Delphi.2007 打印预览汉化问题
我在Delphi 2007 下使用 Quick.Report.Pro.v4.07.Delphi.2007。
现打算把打印预览窗体中的显示信息改为中文, qrprev.dfm qrprev.pas
我把按钮英文提法改为中文后,编译包,把.bpl .dcp 分发到 ..\CodeGear\RAD Studio\5.0\\bin 以及 \CodeGear\RAD Studio\5.0\QuickRep\bpl 下,
可重新Build原来的工程后,预览窗体中的按钮提示信息仍然是英文。
请问如何解决?
------解决方案--------------------
编译后,找到bpl再手动安装QuickReport
------解决方案--------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, QuickRpt, QRCtrls, ExtCtrls,ToolWin,
ComCtrls, Buttons;
type
TForm2 = class(TForm)
QuickRep: TQuickRep;
QRDBText1: TQRDBText;
QRLabel1: TQRLabel;
QRBand1: TQRBand;
QRLabel2: TQRLabel;
QRDBText2: TQRDBText;
ADODataSet1: TADODataSet;
procedure QuickRepBeforePrint(Sender: TCustomQuickRep;
var PrintReport: Boolean);
private
{ Private declarations }
public
{ Public declarations }
procedure DoPrint();
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
//QuickRep 汉化的函数
procedure g_InitQuickRpt(const QuickRpt: TQuickRep);
var
i,j: integer;
fmPreview: TForm;
tBar, tButton: TComponent;
begin
if (QuickRpt.QRPrinter.Client=nil) or
(not (QuickRpt.QRPrinter.Client.Parent is TForm)) then Exit;
fmPreview := TForm(QuickRpt.QRPrinter.Client.Parent);
for i := 0 to fmPreview.ControlCount - 1 do
begin
tBar := fmPreview.Controls[i];
if tBar is TToolbar then
begin
for j := 0 to TToolBar(tBar).ControlCount - 1 do
begin
tButton := TToolBar(tBar).Controls[j];
//汉化工具栏的 TToolButton 按钮
if tButton is TToolButton then
begin
//根据tButton.Name作汉化。
if LowerCase(tButton.Name)='zoomfit' then TToolButton(tButton).Hint := '适合整页';
if LowerCase(tButton.Name)='zoom100' then TToolButton(tButton).Hint := '原始比例';
if LowerCase(tButton.Name)='zoomtowidth' then TToolButton(tButton).Hint := '适合页宽';
if LowerCase(tButton.Name)='firstpage' then TToolButton(tButton).Hint := '首页';
if LowerCase(tButton.Name)='previouspage' then TToolButton(tButton).Hint := '上一页';
if LowerCase(tButton.Name)='toolbutton2' then TToolButton(tButton).Hint := '下一页';
if LowerCase(tButton.Name)='lastpage' then TToolButton(tButton).Hint := '末页';
if LowerCase(tButton.Name)='toolbutton3' then TToolButton(tButton).Hint := '跳转到';
if LowerCase(tButton.Name)='printsetup' then TToolButton(tButton).Hint := '打印设置';
if LowerCase(tButton.Name)='print' then TToolButton(tButton).Hint := '打印';
if LowerCase(tButton.Name)='savereport' then TToolButton(tButton).Hint := '保存报表';
if LowerCase(tButton.Name)='loadreport' then TToolButton(tButton).Hint := '打开报表';
end;
//汉化 TSpeedButton 按钮,好像就一个 Close 按钮。
if (tButton is TSpeedButton) then
begin
TSpeedButton(tButton).Font.Name := '宋体';
TSpeedButton(tButton).Font.Size := 9;
TSpeedButton(tButton).Hint := '关闭';
TSpeedButton(tButton).Caption := '关闭';
end;
end;
end;
end;
end;
procedure TForm2.DoPrint();
begin
QuickRep.Preview;
end;
procedure TForm2.QuickRepBeforePrint(Sender: TCustomQuickRep; var PrintReport: Boolean);
begin
//汉化工作.
g_InitQuickRpt(QuickRep);
end;
end.