クイックレポートで 1920*1080 解像度プラス 125% 上記の表示設定環境の場合,「プレビュー印刷」の比率が正しくなくなります。(大きすぎるか小さすぎる),しかし、実際の印刷は正常です。,修正したい場合は,コンパイル環境でクイックレポートのqrprntr.pasファイルを修正する必要があります,修正するには2つの方法があります。

◎ ファイルの場所
℃:\プログラムファイル (x86の)\EmbarcaderoStudio16.0Quickrep506qrprntr.pas
◎方法1
FMetafile.Width および FMetafile.Height によって呼び出されるscaleToNativeDeskRes 関数を追加します。。
procedure TQRPrinter . CreateMetafileCanvas; function scaleToNativeDeskRes(pVal: Integer ): Integer ; var tTemp: HDC; begin tTemp := GetDC( 0 ); try Result := Round((pVal * GetDeviceCaps(tTemp, VERTRES)) / GetDeviceCaps(tTemp, DESKTOPVERTRES)); finally ReleaseDC( 0 , tTemp); end ; end ; begin ... FMetafile . Width := scaleToNativeDeskRes(XSize(PaperWidthValue)); FMetafile . Height := scaleToNativeDeskRes(YSize(PaperLengthValue)); FCanvas := TMetafileCanvas . Create(FMetafile, 0 ); FCanvas . Font . PixelsPerInch := MetafileDPI; ... end ; |
完全な例は次のとおりです
procedure TQRPrinter . CreateMetafileCanvas; // 解決 Windows 字型放大到 125% 以上時,預覽列印的比例會異常的問題。 function scaleToNativeDeskRes(pVal: Integer ): Integer ; var tTemp: HDC; begin tTemp := GetDC( 0 ); try Result := Round((pVal * GetDeviceCaps(tTemp, VERTRES)) / GetDeviceCaps(tTemp, DESKTOPVERTRES)); finally ReleaseDC( 0 , tTemp); end ; end ; begin FMetafile := TMetafile . Create; // {$define HIRES} {$IFDEF HIRES} // try a high res canvas XFactor := GetDeviceCaps(aPrinter . Handle, LogPixelsX) / 254 ; YFactor := GetDeviceCaps(aPrinter . Handle, LogPixelsY) / 254 ; FMetafile . Width := XSize(PaperWidthValue); FMetafile . Height := YSize(PaperLengthValue); FCanvas := TMetafileCanvas . Create(FMetafile, aprinter . Handle); FCanvas . Font . PixelsPerInch := GetDeviceCaps(aprinter . Handle, LOGPIXELSY); { $ELSE } // dpi fix ? suggested by David Martin FMetafile . Width := scaleToNativeDeskRes(XSize(PaperWidthValue)); // add // 在此處調用 scaleToNativeDeskRes。 FMetafile . Height := scaleToNativeDeskRes(YSize(PaperLengthValue)); // add // 在此處調用 scaleToNativeDeskRes。 FCanvas := TMetafileCanvas . Create(FMetafile, 0 ); // add FCanvas . Free; // add if FMetafile . Width > XSize(PaperWidthValue) then // add FMetafile . Inch := ( 96 * FMetafile . Width) div XSize(PaperWidthValue); // add // end fix FMetafile . Width := XSize(PaperWidthValue); FMetafile . Height := YSize(PaperLengthValue); FCanvas := TMetafileCanvas . Create(FMetafile, 0 ); YFactor := Screen . PixelsPerInch / 254 ; XFactor := YFactor; SetGraphicsMode(FCanvas . handle, GM_ADVANCED); // disable this line { $ENDIF } // FHyperlinks := TList.Create; end ; |
◎方法2
実は速報では 5.06 バージョン内,修正が提供されました,書きます {$IFDEF 採用} 下に,ただプログラムが存在しないだけです {$採用を定義する} 高解像度とは何かを定義する,したがって、プログラムは修正プログラムに遭遇しません。
したがって、2 番目の方法は、 {$IFDEF 採用} プログラムを移動します {$それ以外} 下に,元の書き込みを置き換えるだけです。
procedure TQRPrinter . CreateMetafileCanvas; begin FMetafile := TMetafile . Create; // {$define HIRES} {$IFDEF HIRES} { $ELSE } // try a high res canvas // 解決 Windows 字型放大到 125% 以上時,預覽列印的比例會異常的問題。 XFactor := GetDeviceCaps(aPrinter . Handle, LogPixelsX) / 254 ; YFactor := GetDeviceCaps(aPrinter . Handle, LogPixelsY) / 254 ; FMetafile . Width := XSize(PaperWidthValue); FMetafile . Height := YSize(PaperLengthValue); FCanvas := TMetafileCanvas . Create(FMetafile, aprinter . Handle); FCanvas . Font . PixelsPerInch := GetDeviceCaps(aprinter . Handle, LOGPIXELSY); // dpi fix ? suggested by David Martin FMetafile . Width := scaleToNativeDeskRes(XSize(PaperWidthValue)); // add FMetafile . Height := scaleToNativeDeskRes(YSize(PaperLengthValue)); // add FCanvas := TMetafileCanvas . Create(FMetafile, 0 ); // add FCanvas . Free; // add if FMetafile . Width > XSize(PaperWidthValue) then // add FMetafile . Inch := ( 96 * FMetafile . Width) div XSize(PaperWidthValue); // add // end fix FMetafile . Width := XSize(PaperWidthValue); FMetafile . Height := YSize(PaperLengthValue); FCanvas := TMetafileCanvas . Create(FMetafile, 0 ); YFactor := Screen . PixelsPerInch / 254 ; XFactor := YFactor; SetGraphicsMode(FCanvas . handle, GM_ADVANCED); // disable this line { $ENDIF } // FHyperlinks := TList.Create; end ; |
【參考連結】