请问用printersetupdialog能设置纸张大小,横向纵向打印吗? printersetupdialog能设置纸张大小,横向纵向打印.printersetupdialog并不能改变Quickrep1的设置.用QuickRep1.PrinterSetup; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果非要用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的文法,但它报错:[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' 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的帮助问题已解决。 能否将Ehlib的DBGridEh中的隐藏列导出 如何才能及时刷新啊?? dbchart中横坐标不是数值的情况怎么办 求在DELPHI中删除非空文件夹的思路及源码?! 为什么MessageBox出来的消息框会不在所有窗体最前面? 如何把电脑的IP地址连同文件路径一起取出来 或 一起存放。 请问我做的组件为什么在Sample页看不到? 我想问一下,是在DELPHI中程序设计中,怎么样进行数据库记录的统计和显示当前记录号 各位帮忙看一下,下面的代码为何无法报错? 用DELPHI 4.0创建SPLASH窗口的费解现象 想在大连找一份工作,大家给点建议。。。来者有分! 关于stream???? 急
不要忘了加分和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;
[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'
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;