Change Font Size in proportion to change in Form Size

Discussions related to Visual Prolog
Harrison Pratt
VIP Member
Posts: 313
Joined: 5 Nov 2000 0:01

Change Font Size in proportion to change in Form Size

Unread post by Harrison Pratt » 24 Nov 2015 23:59

Hi,

Is there a simple way to adjust the font size used in drawing text in a form when that form is resized?

I am thinking of "rolling my own" predicate(s) to set the font size in proportion to the Form size when that Form is repainted in the onPaint event handler.

Code: Select all

CurrFont = vpi::winGetFont( W ), % get form height and width, % calculate new font size required based on "M" size and % Create NewFont   vpi::winSetFont( W, NewFont ),     vpi::drawTextInRect( W, RCT, String, Flags ), vpi::winSetFont( W, CurrFont ), ...  
I am already dealing with resizing RCT in the onPaint event handler, of course.

User avatar
Thomas Linder Puls
VIP Member
Posts: 1159
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls » 25 Nov 2015 9:02

What about doing it in the size handler instead (somehow it seems more natural)?
Regards Thomas Linder Puls
PDC

Post Reply