如何設定QRPrintDialog中的印表機PaperSize!! |
尚未結案
|
jzchen
一般會員 發表:8 回覆:21 積分:5 註冊:2002-06-01 發送簡訊給我 |
|
pillar62
資深會員 發表:9 回覆:324 積分:271 註冊:2002-04-15 發送簡訊給我 |
|
jzchen
一般會員 發表:8 回覆:21 積分:5 註冊:2002-06-01 發送簡訊給我 |
|
jzchen
一般會員 發表:8 回覆:21 積分:5 註冊:2002-06-01 發送簡訊給我 |
哇哈哈!!.......我找到方法了!!
以下是我的方法...大家參考看看!!多多指教!!
var
aDialog : TQRPrintDialog;
Device,
Driver,
Port : array[0..255] of char;
hDMode : THandle;
DevMode: PDeviceMode;
begin
aDialog := TQRPrintDialog.Create(Application);
aDialog.Printer := TPrinter.Create; ;
aDialog.Printer.PrinterIndex := QuickRep1.PrinterSettings.PrinterIndex ;
aDialog.Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode = 0 then
begin
aDialog.Printer.PrinterIndex := Printer.PrinterIndex;
aDialog.Printer.GetPrinter(Device, Driver, Port, hDMode);
end;
if hDMode = 0 then
Raise Exception.Create('連到印表機失敗!')
else
DevMode := GlobalLock(hDMode);
with DevMode^ do
begin
{ 此處是將QuickRep的設定值帶入印表機}
dmFields := dmFields or DM_COPIES;
dmCopies := QuickRep1.PrinterSettings.Copies ;
dmFields := dmFields or DM_ORIENTATION;
if (QuickRep1.PrinterSettings.Orientation = poPortrait) then
dmOrientation := DMORIENT_PORTRAIT
else if (QuickRep1.PrinterSettings.Orientation = poLandscape) then
dmOrientation := DMORIENT_LANDSCAPE;
dmFields := dmFields or DM_PAPERSIZE;
dmPaperSize := DMPAPER_A4; {需寫ㄧ個轉換TQRPaperSize的function}
end;
if not hDMode = 0 then
GlobalUnlock(hDMode);
with aDialog do
try
MinPage := 0 ;
MaxPage := 9999;
Options := [poPageNums, poWarning, poSelection];
if Execute then begin
{再將aDialog的設定值帶入QuickRep中}
end;
finally
free;
end;
end; YA!!YA!!YA!!.....大功告成!!
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |