Page 1 of 1

Change Font Size in proportion to change in Form Size

Posted: 24 Nov 2015 23:59
by Harrison Pratt
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.

Posted: 25 Nov 2015 9:02
by Thomas Linder Puls
What about doing it in the size handler instead (somehow it seems more natural)?