Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Changing dialog font at run-time


2 replies to this topic

Shawn

Shawn
  • Members
  • 4 posts

Posted 05 September 2002 - 14:16

I want to change the font size of dialog boxes at run-time. For example, if the screen resolution is 1024x768 then I want the dialog to use, 28 point Tahoma and if it is 800x600 I want to use 20 point.

We are installing software for the visually impaired, that's why we are using large fonts in our dialogs. The trick is making  the size of the text the same "real" size between different screen resolutions.

One solution I have is creating multiple sets of dialogs in a resource dll (and choosing the appropriate one at run-time) this is a maintenance hassle.

discomonger

discomonger
  • Members
  • 16 posts

Posted 07 September 2002 - 00:19

You can change the size and font of text at run-time if you have a custom script that handles the dialog.  In the DLG_INIT case you'd have something like:

hwndFont = GetFont("Tahoma", 20, STYLE_NORMAL);
CtrlSetFont (DLG_FINAL, hwndFont, TEXT1);
CtrlSetFont (DLG_FINAL, hwndFont, TEXT2);

Where TEXT1 and TEXT2 are the resource ids of the text objects you want to change (i.e. you have a header file for your custom script with #define TEXT1 1003, etc.).

Don't know if it's any less of a maintanence hassle though...

Shawn

Shawn
  • Members
  • 4 posts

Posted 12 September 2002 - 21:30

I tried this. This only changes the size of text in controls but the size controls themselves remain unchanged. You get text that's clipped. I want to change the font size attribute of the dialog box (like you can do in a resource editor). This scales all the controls.

Thanks for the help. I've since created different sets of dialogs and choose the correct set at run time.