How to load font to combobox in C#? -


i using code here: search on stackoverflow:

list<string> fonts = new list<string>();  foreach (fontfamily font in system.drawing.fontfamily.families) {     fonts.add(font.name); } 

updated: resolved problem. think not best solution working me. here:

private void cbxfontsize_selectedindexchanged(object sender, eventargs e) {     lblfontsample.font = new font(lblfontsample.font.fontfamily, convert.toint32(cbxfontsize.selecteditem), lblfontsample.font.style); }  private void cbxfont_textchanged(object sender, eventargs e) {     try     {         lblfontsample.font = new font(cbxfont.text, lblfontsample.font.size);     }      catch { } }  private void frmconvertimage_load(object sender, eventargs e) {     foreach (fontfamily fonts in fontfamily.families)     {         cbxfont.items.add(fonts.name.tostring());     } } 


Comments