0

I have two Comboboxes: [_cmbxFontName, _cmbxStyleName]

I can load all installed fonts into _cmbxFontName, but I could not load fonts styles. If I select a font name in _cmbxFontName, then the other _cmbxstyleName combobox wants to load its styles. for example" [Regular, Normal, Bold, Italic, etc].

I know all fonts have different styles but how can I find and load them?

1 Answer 1

2

You can use the System.Drawing.FontStyle enumeration to list the styles. I think you can specify any style in FontStyle for any font when the font is created.

New Font(FontFamily.GenericSansSerif, 12.0F, FontStyle.Bold)

You can load the font styles into a combo box like this:

Dim styles() As FontStyle
Dim style As FontStyle

styles = System.Enum.GetValues(GetType(FontStyle))
For Each style In styles
  combobox1.items.add(style.ToString)
Next style
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.