繁体   English   中英

更改TextBox中的字体样式

[英]Change a font style in a TextBox

我有几个文本框,其中添加了输入。 所有这些输入都会在单击按钮后显示在程序底部的文本框中。

我想让这些字符串中的一个在程序底部的文本框中显示为斜体。

这就是我所拥有的。

private void button1_Click(object sender,EventArgs e){string author; 字符串名称; 弦年; 字符串标题; 串位; 字符串出版商

        name = textBox2.Text + ", ";
        author = textBox1.Text + ". ";
        year =  "(" + textBox3.Text + ") ";
        title = textBox4.Text + ", ";
        place = textBox5.Text + ", ";
        publisher = textBox6.Text + ".";


        // output to reference field


        richTextBox1.Text = name + author + year + title + place + publisher;

    }

我想要的是以斜体显示标题字符串。

任何帮助都会很棒。 谢谢

richTextBox1.Find(title, RichTextBoxFinds.MatchCase);
richTextBox1.SelectionFont = new Font(richTextBox1.Font, FontStyle.Italic);

这应该保持书的标题和书的标题,同时保持字体与富文本框的其余部分相同。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM