Helllo,
I use TRichView 18.
If I set windows scaling from 100 to 150 the size of the text inside the TRichview is scaled. My problem: I use TRVReportHelper to print the content with FastReport. It works fine - but if I change the WIndows scaling, the fontsize scales, too - and this is bad. How can I change this behaviour?
In help I found this:
https://www.trichview.com/help/idh_tric ... rinch.html
but has no effect... Any hints?
Best regards
Wolfgang
RichViewEdit and WIndows Textscaling
-
- Posts: 11
- Joined: Fri Jun 06, 2014 5:32 am
- Location: Germany
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RichViewEdit and WIndows Textscaling
DocumentPixelsPerInch does not work for TRVReportHelper, its only for TRichView and TRichViewEdit.
Unfortunately, the current version of the components does not allow to define a DPI of the target Canvas, it always uses the actual Canvas DPI. So, for screen canvas, it is always the screen DPI.
(although it's not difficult to add this feature, it is already implemented in ReportBuilder wrapper in a component inherited from TRVRepoertHelper; probably, I'll add this feature in future).
I can suggest an alternative solution. Instead of TRVReportHelper, you can use TRVPrint with VirtualPrinter.Active = True.
In this mode, you can define desired DPI in RVPrint.VirtualPrinter.PixelsPerInchX and Y properties. You can assign all RVPrint.Margins = 0 to make the result look like in TRVReportHelper. The only problem, TRVPrint does not store a document, so you need to store it somewhere else.
Unfortunately, the current version of the components does not allow to define a DPI of the target Canvas, it always uses the actual Canvas DPI. So, for screen canvas, it is always the screen DPI.
(although it's not difficult to add this feature, it is already implemented in ReportBuilder wrapper in a component inherited from TRVRepoertHelper; probably, I'll add this feature in future).
I can suggest an alternative solution. Instead of TRVReportHelper, you can use TRVPrint with VirtualPrinter.Active = True.
In this mode, you can define desired DPI in RVPrint.VirtualPrinter.PixelsPerInchX and Y properties. You can assign all RVPrint.Margins = 0 to make the result look like in TRVReportHelper. The only problem, TRVPrint does not store a document, so you need to store it somewhere else.
-
- Posts: 11
- Joined: Fri Jun 06, 2014 5:32 am
- Location: Germany
Re: RichViewEdit and WIndows Textscaling
where can I find this wrapper? Maybe I can apply this part of code in my FastReport Wrapper - I need to print more data in this report than the rtf....Sergey Tkachenko wrote: ↑Thu Jul 16, 2020 12:05 pm (although it's not difficult to add this feature, it is already implemented in ReportBuilder wrapper in a component inherited from TRVRepoertHelper; probably, I'll add this feature in future).
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RichViewEdit and WIndows Textscaling
In <TRichView Dir>\ThirdParty\ReportBuilder\Source\ppRichView.pas
It is TRVReportHelperRef that has internal TRichView of TReportRichViewRef class that has RVData of TReportRVDataRef class.
TRVReportHelperRef has several additional features, for example it can store documents in DFM (or, in this case, in reports).
But the most interesting is TReportRVDataRef.GetSADForFormatting method that overrides the target DPI by the value specified in FInternalPixelsPerInch.
It is TRVReportHelperRef that has internal TRichView of TReportRichViewRef class that has RVData of TReportRVDataRef class.
TRVReportHelperRef has several additional features, for example it can store documents in DFM (or, in this case, in reports).
But the most interesting is TReportRVDataRef.GetSADForFormatting method that overrides the target DPI by the value specified in FInternalPixelsPerInch.
-
- Posts: 11
- Joined: Fri Jun 06, 2014 5:32 am
- Location: Germany
Re: RichViewEdit and WIndows Textscaling
Thanks.
I convert the relevant code to my component:
The code (GetSADForFormatting) works (Breakpoint for debugging) but the output is the very same: different between 100% and 150% scaling: Have I missed something?
Best regards
I convert the relevant code to my component:
Code: Select all
{ TRVReportHelperFR }
function TRVReportHelperFR.CreateRichView: TCustomPrintableRV;
begin
Result := TReportRichViewFR.Create(Self);
end;
{ TReportRichViewFR }
constructor TReportRichViewFR.Create(AOwner: TComponent);
begin
inherited;
FInternalPixelsPerInch := 72;
end;
function TReportRichViewFR.GetDataClass: TRichViewRVDataClass;
begin
Result := TReportRVDataRef;
end;
{ TReportRVDataRef }
procedure TReportRVDataRef.GetSADForFormatting(Canvas: TCanvas; out sad: TRVScreenAndDevice);
var
ppi: Integer;
begin
inherited;
ppi := TReportRichViewFR(RichView).FInternalPixelsPerInch;
if ppi > 0 then
begin
PrnSad.ppixDevice := ppi;
PrnSad.ppiyDevice := ppi;
sad.ppixDevice := ppi;
sad.ppiyDevice := ppi;
end;
end;
Best regards
- Attachments
-
- Prot_150.png (8.8 KiB) Viewed 18772 times
-
- Prot_100.png (6 KiB) Viewed 18772 times
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RichViewEdit and WIndows Textscaling
In addition to overriding GetSADForFormatting, you need to assign Canvas.PixelsPerInch = FInternalPixelsPerInch (before calling Init; and, if a canvas for drawing is different, before calling DrawPage/DrawPageAt
-
- Posts: 11
- Joined: Fri Jun 06, 2014 5:32 am
- Location: Germany
Re: RichViewEdit and WIndows Textscaling
Thank you very very much!!!
I need also set PixelPoInch to a MetafileCanvas on which we are painting....
I need also set PixelPoInch to a MetafileCanvas on which we are painting....