请问用printersetupdialog能设置纸张大小,横向纵向打印吗?

ych121 2002-06-21 11:11:15
我想用printersetupdialog来设置需打印的报表的纸张大小等,而且希望在预鉴览中看到.
...全文
385 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ych121 2002-06-24
  • 打赏
  • 举报
回复
非常感谢superljj的帮助问题已解决。
ych121 2002-06-21
  • 打赏
  • 举报
回复
请试了一下superljj的文法,但它报错:
[Error] hmreport.pas(136): Undeclared identifier: 'GetPrintIndex'
[Error] hmreport.pas(136): Undeclared identifier: 'Printer'
[Error] hmreport.pas(141): Undeclared identifier: 'GetPrinter'
[Error] hmreport.pas(146): Undeclared identifier: 'Letter'
[Error] hmreport.pas(147): Undeclared identifier: 'LetterSmall'
[Error] hmreport.pas(148): Undeclared identifier: 'Tabloid'
[Error] hmreport.pas(149): Undeclared identifier: 'Ledger'
[Error] hmreport.pas(150): Undeclared identifier: 'Legal'
[Error] hmreport.pas(151): Undeclared identifier: 'Statement'
[Error] hmreport.pas(152): Undeclared identifier: 'Executive'
[Error] hmreport.pas(153): Undeclared identifier: 'A3'
[Error] hmreport.pas(154): Undeclared identifier: 'A4'
[Error] hmreport.pas(155): Undeclared identifier: 'A4Small'
[Error] hmreport.pas(156): Undeclared identifier: 'A5'
[Error] hmreport.pas(157): Undeclared identifier: 'B4'
[Error] hmreport.pas(158): Undeclared identifier: 'B5'
[Error] hmreport.pas(159): Undeclared identifier: 'Folio'
[Error] hmreport.pas(160): Undeclared identifier: 'Quarto'
[Error] hmreport.pas(161): Undeclared identifier: 'qr10X14'
[Error] hmreport.pas(162): Undeclared identifier: 'qr11X17'
[Error] hmreport.pas(163): Undeclared identifier: 'Note'
[Error] hmreport.pas(164): Undeclared identifier: 'Env9'
[Error] hmreport.pas(165): Undeclared identifier: 'Env10'
[Error] hmreport.pas(166): Undeclared identifier: 'Env11'
[Error] hmreport.pas(167): Undeclared identifier: 'Env12'
[Error] hmreport.pas(168): Undeclared identifier: 'Env14'
[Error] hmreport.pas(191): Statement expected but 'PROCEDURE' found
[Fatal Error] yusuan.dpr(69): Could not compile used unit 'hmreport.pas'
superljj 2002-06-21
  • 打赏
  • 举报
回复
如果非要用printersetupdialog, 调用如下函数
不要忘了加分和FAQ.

Function MainPrintSet(MainQuickrep:TQuickrep):Boolean;
Var
Device, Driver, Port: array[0..255] of char;
ADevMode: THandle ;
DevMode: PDeviceMode;
Begin
Try
Result:=True;
MainQuickrep.Units := Pixels;
If GetPrintIndex<>Printer.PrinterIndex Then
DefaultPrinterFlag:=True;
MainQuickrep.PrinterSettings.PrinterIndex := printer.PrinterIndex;
MainQuickrep.Page.Orientation := printer.Orientation;
with Printer do
GetPrinter(Device, Driver, Port, ADevMode);
if ADevMode<>0 then
Begin
DevMode := GlobalLock(ADevMode);
Case DevMode^.dmPaperSize of
DMPAPER_LETTER: MainQuickrep.Page.PaperSize :=Letter;
DMPAPER_LETTERSMALL: MainQuickrep.Page.PaperSize :=LetterSmall;
DMPAPER_TABLOID: MainQuickrep.Page.PaperSize :=Tabloid;
DMPAPER_lEDGER: MainQuickrep.Page.PaperSize :=Ledger;
DMPAPER_lEGAL: MainQuickrep.Page.PaperSize :=Legal;
DMPAPER_STATEMENT: MainQuickrep.Page.PaperSize :=Statement;
DMPAPER_EXECUTIVE: MainQuickrep.Page.PaperSize :=Executive;
DMPAPER_A3: MainQuickrep.Page.PaperSize :=A3;
DMPAPER_A4: MainQuickrep.Page.PaperSize :=A4;
DMPAPER_A4SMALL: MainQuickrep.Page.PaperSize :=A4Small;
DMPAPER_A5: MainQuickrep.Page.PaperSize :=A5;
DMPAPER_B4: MainQuickrep.Page.PaperSize :=B4;
DMPAPER_B5: MainQuickrep.Page.PaperSize :=B5;
DMPAPER_FOLIO: MainQuickrep.Page.PaperSize :=Folio;
DMPAPER_QUARTO: MainQuickrep.Page.PaperSize :=Quarto;
DMPAPER_10X14: MainQuickrep.Page.PaperSize :=qr10X14;
DMPAPER_11X17: MainQuickrep.Page.PaperSize :=qr11X17;
DMPAPER_NOTE: MainQuickrep.Page.PaperSize :=Note;
DMPAPER_ENV_9: MainQuickrep.Page.PaperSize :=Env9;
DMPAPER_ENV_10: MainQuickrep.Page.PaperSize :=Env10;
DMPAPER_ENV_11: MainQuickrep.Page.PaperSize :=Env11;
DMPAPER_ENV_12: MainQuickrep.Page.PaperSize :=Env12;
DMPAPER_ENV_14: MainQuickrep.Page.PaperSize :=Env14;
else
Begin
GlobalUnlock(ADevMode);
Result:=false;
Exit;
//MainQuickrep.Page.PaperSize :=Letter;
//DevMode^.dmFields := DevMode^.dmFields or DM_PaperSize;
//DevMode^.dmPaperSize := DMPAPER_LETTER;

End;
End;
GlobalUnlock(ADevMode);
End;
Except
On E:Exception do
Begin
Result:=false;
Exit;
end;
end;
superljj 2002-06-21
  • 打赏
  • 举报
回复
printersetupdialog能设置纸张大小,横向纵向打印.
printersetupdialog并不能改变Quickrep1的设置.


用QuickRep1.PrinterSetup;
superljj 2002-06-21
  • 打赏
  • 举报
回复
Function MainPrintSet(MainQuickrep:TQuickrep):Boolean;
Var
Device, Driver, Port: array[0..255] of char;
ADevMode: THandle ;
DevMode: PDeviceMode;
Begin
Try
Result:=True;
MainQuickrep.Units := Pixels;
MainQuickrep.PrinterSettings.PrinterIndex := printer.PrinterIndex;
MainQuickrep.Page.Orientation := printer.Orientation;
with Printer do
GetPrinter(Device, Driver, Port, ADevMode);
if ADevMode<>0 then
Begin
DevMode := GlobalLock(ADevMode);
Case DevMode^.dmPaperSize of
DMPAPER_LETTER: MainQuickrep.Page.PaperSize :=Letter;
DMPAPER_LETTERSMALL: MainQuickrep.Page.PaperSize :=LetterSmall;
DMPAPER_TABLOID: MainQuickrep.Page.PaperSize :=Tabloid;
DMPAPER_lEDGER: MainQuickrep.Page.PaperSize :=Ledger;
DMPAPER_lEGAL: MainQuickrep.Page.PaperSize :=Legal;
DMPAPER_STATEMENT: MainQuickrep.Page.PaperSize :=Statement;
DMPAPER_EXECUTIVE: MainQuickrep.Page.PaperSize :=Executive;
DMPAPER_A3: MainQuickrep.Page.PaperSize :=A3;
DMPAPER_A4: MainQuickrep.Page.PaperSize :=A4;
DMPAPER_A4SMALL: MainQuickrep.Page.PaperSize :=A4Small;
DMPAPER_A5: MainQuickrep.Page.PaperSize :=A5;
DMPAPER_B4: MainQuickrep.Page.PaperSize :=B4;
DMPAPER_B5: MainQuickrep.Page.PaperSize :=B5;
DMPAPER_FOLIO: MainQuickrep.Page.PaperSize :=Folio;
DMPAPER_QUARTO: MainQuickrep.Page.PaperSize :=Quarto;
DMPAPER_10X14: MainQuickrep.Page.PaperSize :=qr10X14;
DMPAPER_11X17: MainQuickrep.Page.PaperSize :=qr11X17;
DMPAPER_NOTE: MainQuickrep.Page.PaperSize :=Note;
DMPAPER_ENV_9: MainQuickrep.Page.PaperSize :=Env9;
DMPAPER_ENV_10: MainQuickrep.Page.PaperSize :=Env10;
DMPAPER_ENV_11: MainQuickrep.Page.PaperSize :=Env11;
DMPAPER_ENV_12: MainQuickrep.Page.PaperSize :=Env12;
DMPAPER_ENV_14: MainQuickrep.Page.PaperSize :=Env14;
else
Begin
GlobalUnlock(ADevMode);
Result:=false;
Exit;
//MainQuickrep.Page.PaperSize :=Letter;
//DevMode^.dmFields := DevMode^.dmFields or DM_PaperSize;
//DevMode^.dmPaperSize := DMPAPER_LETTER;

End;
End;
GlobalUnlock(ADevMode);
End;
Except
On E:Exception do
Begin
Result:=false;
Exit;
end;
end;
end;
superljj 2002-06-21
  • 打赏
  • 举报
回复
uses QRPrntr;

5,390

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧