How to list all font in combobox, and how to change selected font in list accordin font in combobox? Thanks.
Printable View
How to list all font in combobox, and how to change selected font in list accordin font in combobox? Thanks.
You would have to create your own combobox and override the ondraw event of each item. It is not hard to do, but it can be tricky to get right. Here is some code to get you started:
This is a new combobox that inherits from the base combo box. So add this code as a new class, compile once, then you should see a new object in your toolbox called FontCombo.Code:Public Class FontCombo
Inherits ComboBox
Private Sub FontCombo_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
Dim s As String = Me.Items(e.Index).ToString()
e.Graphics.DrawString(s, New Font(s, e.Font.Size, FontStyle.Regular), Brushes.Black, e.Bounds)
End Sub
End Class
EDIT: Actually I think I misread your post and bulldogs suggestion is more in line with what you are looking for.
Thanks!