c#怎么做像word那样的文字大小下拉选择栏?要求有word那样的效果

如题所述

     //添加一个comboBox,一个richTextBox
        private void Form1_Load(object sender, EventArgs e)
        {
            int[] arrFont = { 10, 20, 32, 34, 36, 40 };
            for (int i = 0; i < arrFont.Length; i++) 
            {
                comboBox1.Items.Add(arrFont[i]);
            }
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Font font = new Font(FontFamily.GenericSerif,int.Parse(comboBox1.Text), FontStyle.Regular);
            richTextBox1.SelectionFont = font;
        }

温馨提示:答案为网友推荐,仅供参考
相似回答