Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable a style list in TFontDialog?

Tags:

fonts

delphi

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.

like image 720
Y.N Avatar asked May 17 '16 16:05

Y.N


People also ask

What are the options in the font dialog box?

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).

What is font dialog box in word?

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.

What is FontDialog C#?

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.


1 Answers

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'.

like image 130
Sertac Akyuz Avatar answered Oct 10 '22 20:10

Sertac Akyuz