直接修改注册表 //设定打印的方向为纵向或横向 procedure TprintAX.setportrait(portrait: WordBool); begin if(portrait) then //横向 //Printer.Orientation := poLandscape Printer.Orientation := poLandscape else //纵向 Printer.Orientation := poPortrait; end;//设定页眉 procedure TprintAX.setheader(const header: WideString); var registertemp : TRegistry; begin registertemp := tregistry.create; with registertemp do begin rootkey:=HKEY_CURRENT_USER; if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then begin writestring('header', header); end; closekey; free; end; end;//设定页脚 procedure TprintAX.setfooter(const footer: WideString); var registertemp : TRegistry; begin registertemp := tregistry.create; with registertemp do begin rootkey:=HKEY_CURRENT_USER; if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then begin writestring('footer', footer); end; closekey; free; end; end;//设定左边距 procedure TprintAX.setleft(const left: WideString); var registertemp : TRegistry; begin registertemp := tregistry.create; with registertemp do begin rootkey:=HKEY_CURRENT_USER; if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then begin writestring('margin_left', left); end; closekey; free; end; end;//设定右边距 procedure TprintAX.setright(const right: WideString); var registertemp : TRegistry; begin registertemp := tregistry.create; with registertemp do begin rootkey:=HKEY_CURRENT_USER; if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then begin writestring('margin_right', right); end; closekey; free; end; end;//设定顶边距 procedure TprintAX.settop(const top: WideString); var registertemp : TRegistry; begin registertemp := tregistry.create; with registertemp do begin rootkey:=HKEY_CURRENT_USER; if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then begin writestring('margin_top', top); end; closekey; free; end; end;//设定底边距 procedure TprintAX.setbottom(const bottom: WideString); var registertemp : TRegistry; begin registertemp := tregistry.create; with registertemp do begin rootkey:=HKEY_CURRENT_USER; if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then begin writestring('margin_bottom', bottom); end; closekey; free; end; end;
//设定打印的方向为纵向或横向
procedure TprintAX.setportrait(portrait: WordBool);
begin
if(portrait) then
//横向
//Printer.Orientation := poLandscape
Printer.Orientation := poLandscape
else
//纵向
Printer.Orientation := poPortrait;
end;//设定页眉
procedure TprintAX.setheader(const header: WideString);
var
registertemp : TRegistry;
begin
registertemp := tregistry.create;
with registertemp do
begin
rootkey:=HKEY_CURRENT_USER;
if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then
begin
writestring('header', header);
end;
closekey;
free;
end;
end;//设定页脚
procedure TprintAX.setfooter(const footer: WideString);
var
registertemp : TRegistry;
begin
registertemp := tregistry.create;
with registertemp do
begin
rootkey:=HKEY_CURRENT_USER;
if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then
begin
writestring('footer', footer);
end;
closekey;
free;
end;
end;//设定左边距
procedure TprintAX.setleft(const left: WideString);
var
registertemp : TRegistry;
begin
registertemp := tregistry.create;
with registertemp do
begin
rootkey:=HKEY_CURRENT_USER;
if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then
begin
writestring('margin_left', left);
end;
closekey;
free;
end;
end;//设定右边距
procedure TprintAX.setright(const right: WideString);
var
registertemp : TRegistry;
begin
registertemp := tregistry.create;
with registertemp do
begin
rootkey:=HKEY_CURRENT_USER;
if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then
begin
writestring('margin_right', right);
end;
closekey;
free;
end;
end;//设定顶边距
procedure TprintAX.settop(const top: WideString);
var
registertemp : TRegistry;
begin
registertemp := tregistry.create;
with registertemp do
begin
rootkey:=HKEY_CURRENT_USER;
if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then
begin
writestring('margin_top', top);
end;
closekey;
free;
end;
end;//设定底边距
procedure TprintAX.setbottom(const bottom: WideString);
var
registertemp : TRegistry;
begin
registertemp := tregistry.create;
with registertemp do
begin
rootkey:=HKEY_CURRENT_USER;
if openkey('\Software\Microsoft\Internet Explorer\PageSetup', true) then
begin
writestring('margin_bottom', bottom);
end;
closekey;
free;
end;
end;