比如说:用BUTTON触发打印事件 begin if printdialog1.execute then printtext(100,100:integer;text:string) ..... 可以么?这个控件的对象查看器里只能设纸宽和纸高。 还有说明文件里的那些东西在程序里不用敲了吧(在加了控件 的情况下) 那个高人能指点一二,给个小例子!!!!!
---------------unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DJPrint, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; DJPrint1: TDJPrint; PrintDialog1: TPrintDialog; procedure Button1Click(Sender: TObject);//对齐方式 Function GetPaperWidth:integer;//纸的实际宽度,单位:0.1毫米 Function GetPaperHeight:integer;//纸的实际高度,单位:0.1毫米 Function GetWidth:integer;// 纸的实际宽度,单位:point Function GetHeight:integer; //纸的实际长度,单位:point Function GetOffSetX:integer;//纸的左边距 Function GetOffSetY:integer;//纸的右边距 Function PToPX(value:integer):integer;//将X轴实际尺寸转化为点距(单位:0.1毫米) Function PToPY(value:integer):integer;//将Y轴实际尺寸转化为点距(单位:0.1毫米) FUnction GetPixelsX:integer; //取得水平方向分辨率 Function GetPixelsY:integer; procedure PrintText(x,y:integer;Text:string);// 以指定位置(单位0.1毫米),字距,行局,打印一行 procedure ExtPrint(x,y:integer;Text:string);//WordSpace:字距;以指定位置(单位0.1毫米),字距,行局,是否折行打印多行 private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject); var w : integer; h : integer; txt : string; begin w := 10; h:=90; txt:=edit1.text; if printdialog1.execute then begin printtext(w,h ;txt); end; end;end.-------------- 编译没过去,提示为 [Error] Unit1.pas(53): Not enough actual parameters [Error] Unit1.pas(55): '.' expected but ';' found
begin
if printdialog1.execute then
printtext(100,100:integer;text:string)
.....
可以么?这个控件的对象查看器里只能设纸宽和纸高。
还有说明文件里的那些东西在程序里不用敲了吧(在加了控件
的情况下)
那个高人能指点一二,给个小例子!!!!!
只有6k多!!!!!
安装:
自己新建一个Package(包),单击新建工具按钮,选择Package,在Packages窗口中单击Add按钮,单击Browse按钮,在文件选取对话框中把文件类型设成:Delphi Compiled Unit(*.dcu),然后找到你下载的dcu文件,一路OK下来,再把这个包文件和dcu文件保存在一些,最后编译这个包,并Install它。
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DJPrint, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
DJPrint1: TDJPrint;
PrintDialog1: TPrintDialog;
procedure Button1Click(Sender: TObject);//对齐方式
Function GetPaperWidth:integer;//纸的实际宽度,单位:0.1毫米
Function GetPaperHeight:integer;//纸的实际高度,单位:0.1毫米
Function GetWidth:integer;// 纸的实际宽度,单位:point
Function GetHeight:integer; //纸的实际长度,单位:point
Function GetOffSetX:integer;//纸的左边距
Function GetOffSetY:integer;//纸的右边距
Function PToPX(value:integer):integer;//将X轴实际尺寸转化为点距(单位:0.1毫米)
Function PToPY(value:integer):integer;//将Y轴实际尺寸转化为点距(单位:0.1毫米)
FUnction GetPixelsX:integer; //取得水平方向分辨率
Function GetPixelsY:integer;
procedure PrintText(x,y:integer;Text:string);// 以指定位置(单位0.1毫米),字距,行局,打印一行
procedure ExtPrint(x,y:integer;Text:string);//WordSpace:字距;以指定位置(单位0.1毫米),字距,行局,是否折行打印多行
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
var
w : integer;
h : integer;
txt : string;
begin
w := 10;
h:=90;
txt:=edit1.text;
if
printdialog1.execute then
begin
printtext(w,h ;txt);
end;
end;end.--------------
编译没过去,提示为
[Error] Unit1.pas(53): Not enough actual parameters
[Error] Unit1.pas(55): '.' expected but ';' found
printtext(w,h ,'test print');
djprint1.printtext(w,h ,'test print');