changing_20the_20font_20of_20a_20control
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
changing_20the_20font_20of_20a_20control [2018/03/31 13:19] – external edit 127.0.0.1 | changing_20the_20font_20of_20a_20control [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Changing the font of a control===== | =====Changing the font of a control===== | ||
- | //by Richard Russell, October 2006//\\ \\ By default a Windows control (e.g. edit box, list box or static box) uses a font which in most circumstances should be suitable for your needs. This is particularly so for a control in a dialogue box, because the default font size is determined by system-wide settings which are under the control of the user (for example he may have selected Large Fonts).\\ \\ However there may be rare circumstances when you need to change the font used by a control. In the case of a control on your main window you can do that as follows:\\ | + | //by Richard Russell, October 2006//\\ \\ By default a Windows control (e.g. edit box, list box or static box) uses a font which in most circumstances should be suitable for your needs. This is particularly so for a control in a dialogue box, because the default font size is determined by system-wide settings which are under the control of the user (for example he may have selected Large Fonts).\\ \\ However there may be rare circumstances when you need to change the font used by a control. In the case of a control on your main window you can do that as follows: |
+ | |||
+ | <code bb4w> | ||
WM_SETFONT = 48 | WM_SETFONT = 48 | ||
*FONT Courier New,9,B | *FONT Courier New,9,B | ||
SYS " | SYS " | ||
- | where **hbox%** is the window handle of the control, typically as returned from [[http:// | + | </ |
+ | |||
+ | where **hbox%** is the window handle of the control, typically as returned from [[http:// | ||
+ | |||
+ | <code bb4w> | ||
WM_SETFONT = 48 | WM_SETFONT = 48 | ||
*FONT Courier New,9,B | *FONT Courier New,9,B | ||
SYS " | SYS " | ||
- | Here **dlg%** is the value returned from [[http:// | + | </ |
+ | |||
+ | Here **dlg%** is the value returned from [[http:// | ||
+ | |||
+ | <code bb4w> | ||
WM_SETFONT = 48 | WM_SETFONT = 48 | ||
SYS " | SYS " | ||
SYS " | SYS " | ||
- | Where **h%** is the height in pixels, **w%** is the weight (400 = normal, 700 = bold), **i%** is 1 for //italic// and **u%** is 1 for __underlined__. You should delete the font when you have finished with it (i.e. when all the controls using it have been closed):\\ | + | </ |
+ | |||
+ | Where **h%** is the height in pixels, **w%** is the weight (400 = normal, 700 = bold), **i%** is 1 for //italic// and **u%** is 1 for __underlined__. You should delete the font when you have finished with it (i.e. when all the controls using it have been closed): | ||
+ | |||
+ | <code bb4w> | ||
SYS " | SYS " | ||
- | \\ **Important note:** The text size resulting from a *FONT command varies according to the current Dots Per Inch setting (see [[/ | + | </ |
+ | |||
+ | **Important note:** The text size resulting from a *FONT command varies according to the current Dots Per Inch setting (see [[/ |
changing_20the_20font_20of_20a_20control.1522502348.txt.gz · Last modified: 2024/01/05 00:18 (external edit)