How to disable a style list in TFontDialog ?
I want to allow users to choose only font name and size.
Effects like strikeout are already disabled with ''fdEffects'' option.
The Font dialog box lets the user choose attributes for a logical font, such as font family and associated font style, point size, effects (underline, strikeout, and text color), and a script (or character set).
Displays a sample of the font that you have selected. The sample shows the font, style, size, effects, and color that you have specified. Use this box to preview the results as you experiment with different formatting options.
A FontDialog control in WinForms is used to select a font from available fonts installed on a system. A typical Font Dialog looks like Figure 1 where you can see there is a list of fonts, styles, size and other options.
The font common dialog of the API, which the VCL component is a wrapper for, does not provide that functionality. See documentation for more detail.
You can disable the style listbox yourself in an OnShow
event handler of the dialog:
EnableWindow(GetDlgItem(FontDialog.Handle, cmb2), False);
Or hide it entirely like fdEffects
does to effects checkboxes:
ShowWindow(GetDlgItem(FontDialog.Handle, cmb2), SW_HIDE);
'cmb2' is defined in 'winapi.dlgs.pas'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With