Non-client metrics are the settings for the width, height, and fonts of items on a window’s border. Setting the properties of a NonClientMetrics object (NONCLIENTMETRICS.CLS) affects the entire Windows display and allows you to control display attributes such as the size of the buttons on a window’s caption bar and the font used by the MsgBox function.
The properties supplied by the NonClientMetrics class break down into two categories: simple properties and font properties. The simple properties, described in Table 9.15, allow you to control the size of various border settings, such as the buttons that appear on windows’ caption bars. The font properties, listed in Table 9.16, allow you to change various font settings for the five Font objects. Finally, each of these Font objects supports the properties shown in Table 9.17.
Table 9.15: Simple Properties Supplied by the NonClientMetrics Class
Property | Description |
BorderWidth | Sets or retrieves the standard window sizing border width |
ScrollWidth | Sets or retrieves the width of buttons on scrollbars (or height, for horizontal scrollbars). Also returns the width of vertical scrollbars. Changing this value affects the dimensions of the scrollbars as well |
ScrollHeight | Sets or retrieves the height of buttons on scrollbars (or width, for horizontal scrollbars). Also returns the height of horizontal scrollbars |
CaptionWidth | Sets or retrieves the width of caption bar buttons |
CaptionHeight | Sets or retrieves the height of caption bar buttons |
SmallCaptionWidth | Sets or retrieves the width of small caption bar buttons |
SmallCaptionHeight | Sets or retrieves the height of small caption bar buttons |
MenuWidth | Sets or retrieves the width of menu bar buttons |
MenuHeight | Sets or retrieves the height of menu bar buttons |
Caption | Retrieves the height, in pixels, of a normal caption bar |
SmallCaption | Retrieves the height, in pixels, of a small caption bar |
FixedBorderX | Retrieves the width, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable |
FixedBorderY | Retrieves the height, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable |
Table 9.16: Font Object Properties Supplied by the NonClientMetrics Class
Property | Description |
CaptionFont | Retrieves the caption bar font object |
SmallCaptionFont | Retrieves the small caption bar font object |
MenuFont | Retrieves the menu font object |
StatusFont | Retrieves the status bar font object |
MessageFont | Retrieves the message box font object |
Table 9.17: Properties Supplied by the Font Class
Property | Type | Value |
Size | Long | Point size for the font. Normally 8–127, but depends on the FaceName |
Weight | Long | Integer between 100– 900, where 100 is very light and 900 is very heavy. Normal is 400 and bold is 700 |
Italic | Boolean | True or False |
StrikeOut | Boolean | True or False |
Underline | Boolean | True or False |
FaceName | String | String containing font face name |