TwwDBRichEdit changes Font.Size by Scaling

264 views
Skip to first unread message

mailto...@gmail.com

unread,
Jul 17, 2014, 7:39:04 AM7/17/14
to woll2woll...@googlegroups.com
Hello

How can I prevent that the TwwDBRichEdit Control changes its Font.Size when scaling the Form?
This happens by the Delphi internal routine TForm.ScaleBy(), and also happens when user encrease the DPI Setting in Windows OS.

Big Problem is that I use the RichEdits for Printing. So when a user upscale the Form and then input text in a empty Richedit, the RichEdit uses the encreased FontSize as Default which will no more fit on Paper by Printing.

For a simple Test
- put a TwwDBRichEdit on a Form
- call ScaleBy(140,100)
- call wwDBRichEdit1.Print

So is there a setting that the Font.size of the RichEdit Control will not increase when a user upscale the form?

Thank you

Roy Woll

unread,
Jul 18, 2014, 4:20:27 PM7/18/14
to woll2woll...@googlegroups.com
Its not clear to me why you are calling ScaleBy. What is the purpose of this?

You'll likely need to select a font for your richedit's selected text so that the richedit's selected text font is used, In this way the font property is not relevant. You could also try restore your scale to 100, 100 before printing.

-Roy

mailto...@gmail.com

unread,
Jul 21, 2014, 3:43:38 AM7/21/14
to woll2woll...@googlegroups.com
The scale function (by Windows DPI Setting or by function ScaleBy) is used from people who (I assume) have problems with their eyes. For me I do not need it. But a lot of our (most older) customers have problems to read lables or captions on their high resolution but tiny Monitors. So most of them encrease the Windows DPI size to 125 or 150. And not to force ppl to generally use that global Windows DPI Setting (which is a known problem that it works not as good in Delphi programs) we decided to integrate a internally Scaling function in our software which scalte all forms with the Delphi Method ScalyBy which works with much less glitches as the Windows DPI scaling do.

But nevermind which method the user takes, the font size of the TwwDBRichEdits will encrease as soon you upscale Forms. By DatabaseFields which allready have a content it's no problem because the font size is allready stored in the rtf text. But for blanc blob fields without content the default font size by the next input is encreased because the TwwDBRichEdit control do this by upscaling.

I think this must be a very well known problem because there is shurely a lot of other software around which also use their RTF stored in text blob fields for printing. So my question is: How to fix the font of my around 600 TwwDBRichEdit Controls in the application not to change their font.size property when a user upscale the GUI?

Roy Woll

unread,
Jul 21, 2014, 2:55:30 PM7/21/14
to woll2woll...@googlegroups.com
When you call ScaleBy you are not calling one of our InfoPower methods, but calling Delphi's implementation of ScaleBy. We have no control over this method nor its implementation.  I looked at Delphi's implementation of ScaleBy and it changes the font of any control that ParentFont is set to true. This leads me to believe that you can set ParentFont to false if you wish for the richedit to be unaffected.  There is no global solution to this unless you were working with your own subclassed version of the richedit.

-Roy

mailto...@gmail.com

unread,
Jul 22, 2014, 9:10:15 AM7/22/14
to woll2woll...@googlegroups.com
as a few times said, also the encreasing of the Windows DPI settings do increase the TwwDBRichEdit.font.size. This has NOTHING to do with Delphi or calling the Delphi ScaleBy method. I finalized the ScaleBy method just because it's lot easier for you to reproduce the issue instead of changing the Windows DPI and allways restart or re-login into your OS.

Of cource I understand that the sense of encreasing DPI or upscale forms is to make controls bigger to read it better on Monitor. And yes this is the primary purpose of doing this. But as said it makes some troubles for the RTF Controls as soon you want to PRINT the RTF blob content of such automatic upscaled RichEdits. So my thougt was that many users before trapped into that and so maybe there is a control setting to fix the font.size also by windows scaling?.

I checked the ParentFont property. Sadly it do not change anything whether you set it to true or false.

Roy Woll

unread,
Jul 22, 2014, 6:57:50 PM7/22/14
to woll2woll...@googlegroups.com
Sorry, I misread the code. ParentFont is ignored in this case. I have not heard of this issue being raised before so I don't have any special insight from the past.

Since the problem seems to only occur for you when you have no formatting / content, you can probably just select some text at the beginning and change the selattributes font size before you change the scale. Then it will have the font stored. For instance...

if wwdbrichedit20.Text = '' then
begin
  wwdbrichedit20.SelStart:= 0;
  wwdbrichedit20.SelLength:= 1;
  wwdbrichedit20.SelAttributes.Size:= wwdbrichedit20.Font.Size; // default font when blank
end;
ScaleBy(140, 100);
wwdbrichedit20.SelLength:= 0;


-Roy
Reply all
Reply to author
Forward
0 new messages