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

Change Font Size in proportion to change in Form Size

Unread post 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.
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

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