FontFamily[] ff = FontFamily.Families;

    // Loop and create a sample of each font.
    for (int x = 0; x < ff.Length; x++)
    {

        System.Drawing.Font font = null;

        // Create the font - based on the styles available.
        if (ff[x].IsStyleAvailable(FontStyle.Regular))
            font = new System.Drawing.Font(
                ff[x].Name,
                m_comboBox.Font.Size
                );
        else if (ff[x].IsStyleAvailable(FontStyle.Bold))
            font = new System.Drawing.Font(
                ff[x].Name,
                m_comboBox.Font.Size,
                FontStyle.Bold
                );
        else if (ff[x].IsStyleAvailable(FontStyle.Italic))
            font = new System.Drawing.Font(
                ff[x].Name,
                m_comboBox.Font.Size,
                FontStyle.Italic
                );
        else if (ff[x].IsStyleAvailable(FontStyle.Strikeout))
            font = new System.Drawing.Font(
                ff[x].Name,
                m_comboBox.Font.Size,
                FontStyle.Strikeout
                );
        else if (ff[x].IsStyleAvailable(FontStyle.Underline))
            font = new System.Drawing.Font(
                ff[x].Name,
                m_comboBox.Font.Size,
                FontStyle.Underline
                );

        // Should we add the item?
        if (font != null)
            m_comboBox.Items.Add(font);

    } // End for all the fonts.

posted on 2005-03-17 09:01  stone  阅读(832)  评论(0编辑  收藏  举报