Font/size combobox

Status
Niet open voor verdere reacties.

svh101

Gebruiker
Lid geworden
22 mrt 2011
Berichten
120
Hallo iedereen

ik probeer een klein tekst verwerk programmetje te maken en ik wil een font combobox maken en ook een font size combobox
dus alle lettertypes dat ik op m'n computer heb geinstaleed


Alvast bedankt
 
na verder zoeken heb ik dit gevonden
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.DataSource = FontFamily.Families() 'fill the ComBoBox1 with the list of fonts
        ComboBox1.DisplayMember = "Name" 'show the name of the font in the ComboBox1
    End Sub
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.SelectedItem Is Nothing Then Return 'nothing selected so exit
        Dim fontfam As FontFamily = CType(ComboBox1.SelectedItem, FontFamily) 'convert item to fontfamily
        ComboBox1.Font = New Font(fontfam, ComboBox1.Font.Size, ComboBox1.Font.Style) 'set selected font with same size and style to a button
    End Sub

maar hoe krijg ik deze fonts in de RichTextBox zo dat als ik bijvoorbeeld New Times Roman selecteer dat ik daar mee kan schrijven
 
Laatst bewerkt:
Bedoel je zoiets:
[CPP]RichTextBox1.SelectionFont = New Font(ComboBox1.Text, 12, FontStyle.Regular)[/CPP]


En zou je voortaan je code in code-tags willen zetten ? :)
 
de code werkt maar hoe kan ik de size veranderen
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan