빠른 보고 1920*1080 해상도 플러스 125% 위의 디스플레이 설정 환경이,"미리보기 인쇄"의 비율이 올바르지 않습니다.(너무 크거나 너무 작음),그러나 실제 인쇄는 정상입니다.,교정하고 싶다면,컴파일 환경에서 Quick Report의 qrprntr.pas 파일을 수정해야 합니다.,수정하는 방법은 2가지가 있습니다。

◎ 파일 위치
C:\프로그램 파일 (86)\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
실제로 Quick Report에서는 5.06 버전에서,수정사항이 제공되었습니다.,에 쓰다 {$IFDEF 채용} 아래에,프로그램이 없다는 것 뿐이죠 {$고용을 정의하다} 고해상도를 구성하는 요소 정의,따라서 프로그램은 수정 프로그램으로 실행되지 않습니다.。
따라서 두 번째 방법은 {$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 ; |
【參考連結】