private void 更改字体ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.fontDialog1.ShowDialog() == DialogResult.OK) 
            {
                if (this.richTextBox1.SelectedText == "") 
                {
                    this.richTextBox1.Font = fontDialog1.Font;
                }
                if (this.richTextBox1.SelectedText == this.richTextBox1.SelectedText) 
                {
                    this.richTextBox1.SelectionFont = fontDialog1.Font;
                }
            }
        }从工具箱中拖出fontDialog

解决方案 »

  1.   

     肯定是你 
     new Font(Convert.ToString(toolStripComboBox1.Items[toolStripComboBox1.SelectedIndex]), richTextBox1.SelectionFont.Size);  错了啊 
    下面的可以运行
    private void richTextBox1_SelectionChanged(object sender, EventArgs e)
            {
                if (richTextBox1.SelectedText != "")
                {
                    richTextBox1.SelectionFont = new Font("Goudy Stout",26);            }
            }
      

  2.   

    你是不是想选择一种字体,就把所选中的文字改变成那个字体啊。toolStripComboBox1.Items[toolStripComboBox1.SelectedIndex]), richTextBox1.SelectionFont.Size 
    我想知道你这里面是怎么写的。
      

  3.   

    在这段代码之前加上对SelectedIndex值的判断
    if(toolStripComboBox1.SelectedIndex<0){return;}