如何改变richTextBox的字体大小? [英] How to change richTextBox font size?

查看:98
本文介绍了如何改变richTextBox的字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用以下代码更改字体样式,但似乎没有字体大小选项。我该如何改变它?另外,有没有办法在字体对话框中隐藏样式面板?

I can change the font style with the following code, but there doesn't seem to be font size option. How do I change it? Also, is there a way to hide the styling panel in the font dialog?

        private void fontToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FontDialog fnt = new FontDialog();
            fnt.ShowEffects = false;
            fnt.MinSize = 8;
            fnt.MaxSize = 18;
            fnt.FontMustExist = true;
            if (fnt.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.Font = fnt.Font;
            }
            fnt.Dispose();
        }

基本上我希望能够改变字体类型和大小,但现在还没有别的。

Basically I want to be able to change the font type and size but nothing else for now.

推荐答案


您可以在更改之前选择所有文本  SelectedFont  选项

this.richTextBox1.SelectAll();
this.richTextBox1.SelectionFont = newFont;







这篇关于如何改变richTextBox的字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆