//---------打印设置-------------
unit RepSetupUnit;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons,printers, Spin;type
TRepSetupForm = class(TForm)
Panel1: TPanel;
Label1: TLabel;
TitleEdit: TEdit;
Label2: TLabel;
UpEdit: TEdit;
Label3: TLabel;
DownEdit: TEdit;
Label4: TLabel;
LeftEdit: TEdit;
Label5: TLabel;
RightEdit: TEdit;
Label6: TLabel;
FXComboBox: TComboBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label7: TLabel;
WidthEdit: TEdit;
Label8: TLabel;
LengthEdit: TEdit;
Label9: TLabel;
Label10: TLabel;
PJPRNFontDialog: TFontDialog;
DFontButton: TButton;
DetailHightSpinEdit: TSpinEdit;
Label11: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DFontButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
TopMargin,BottomMargin,LeftMargin,RightMargin:integer;
Orientation: TPrinterOrientation;
PaperWidth,PaperLength:Integer;
Title :String;
FontName:String;
FontSize,DetailHight:Integer;
end;var
RepSetupForm: TRepSetupForm;implementationuses FindInOutUnit;{$R *.DFM}procedure TRepSetupForm.BitBtn1Click(Sender: TObject);
begin
TopMargin := StrToInt(UpEdit.Text);
BottomMargin:= StrToInt(DownEdit.Text);
LeftMargin:= StrToInt(LeftEdit.Text);
RightMargin:= StrToInt(RightEdit.Text);
if FXComboBox.Text='poPortrait' then
Orientation:=poPortrait
else
Orientation:=poLandscape;
Title :=TitleEdit.Text;
PaperWidth := StrToInt(WidthEdit.Text); //纸宽
PaperLength:=StrToInt(LengthEdit.Text); //纸长
FontName := DFontButton.Font.Name;
FontSize := DFontButton.Font.Size;
DetailHight := DetailHightSpinEdit.Value;
end;procedure TRepSetupForm.FormCreate(Sender: TObject);
begin
TopMargin := 10;
BottomMargin:= 10;
LeftMargin:= 10;
RightMargin:= 10;
Orientation:=poPortrait;
Title :='标题';
PaperWidth := 210;
PaperLength:=297;
FontName := '宋体';
FontSize := 12 ;
end;procedure TRepSetupForm.DFontButtonClick(Sender: TObject);
begin
If Not (PJPRNFontDialog.Execute) Then Exit;;
if ActiveControl is TButton then
with ActiveControl as TButton do
Begin
Font.Assign(PJPRNFontDialog.Font);
End
Else
Beep;
end;end.
//------打印------------
try
RepTemp.ActiveDataSource.DataSet := Query;
// RepTemp.QuickRep1.Page.PaperSize:=A4;
RepTemp.QuickRep1.Page.Length:=RepSetupForm.PaperLength;
RepTemp.QuickRep1.Page.Width:=RepSetupForm.PaperWidth;
RepTemp.QuickRep1.Page.BottomMargin:=RepSetupForm.BottomMargin;
RepTemp.QuickRep1.Page.TopMargin:=RepSetupForm.TopMargin;
RepTemp.QuickRep1.Page.LeftMargin:=RepSetupForm.LeftMargin;
RepTemp.QuickRep1.Page.RightMargin:=RepSetupForm.RightMargin;
RepTemp.QuickRep1.Page.Orientation:=RepSetupForm.Orientation;
RepTemp.TitleLabel.Caption:=RepSetupForm.Title;
RepTemp.TmpFontLabel.Font.Name := RepSetupForm.FontName ;
RepTemp.TmpFontLabel.Font.Size := RepSetupForm.FontSize ;
RepTemp.DetailBand1.Height := RepSetupForm.DetailHight;
RepTemp.CreateRep;
RepTemp.QuickRep1.Preview;
finally
RepTemp.free;
end;
解决方案 »
- Tdbedit控件显示内容小问题,高手请进,在线急等!!!!
- delphi如何控制excel的单元格添加颜色,请帮忙
- 如何读取DBF文件中的字段列表
- 怎么样用DELPHI 开发COM组件和调用COM组件,有完整的例子么?,谢谢。
- 用DBEDIT和有EDIT有什么不同
- ado向数据库(access)中添加记录,为何总是出错误?
- 如何把Query,Table,Adoconnection的密码提示去掉
- 关于图像的,高手请进!
- 讨论:程序员应不应该休息。
- DELPHI 两表模糊查询问题
- "not found xxx.dcu"如何处理?的补充
- 求助!!!“不能访问Windows Installer服务”
QRP中定义了纸张A4还能定义大小吗?
另外,需要连续走纸,精确定位
哪位有办法搞定?
RepTemp.QuickRep1.Page.Length:=RepSetupForm.PaperLength;
RepTemp.QuickRep1.Page.Width:=RepSetupForm.PaperWidth;
这两句话是定义纸张大小的
另外,在2000下,设置打印纸张大小应该是
开始--》设置---》打印机,然后在打印机窗口菜单的服务器属性里可以定义纸张的大小,和98下自定义纸张的方法有点不同