在我的组合框中,我有8,9,10和11项,因此当我选择8 9 10或11时我想设置不同的字体大小,有人可以指导我如何从组合框中选择项时设置不同的字体大小吗?
You can register a SelectedIndexChanged
handler at your ComboBox:
private void cmbSize_SelectedIndexChanged(object sender, EventArgs e)
{
float size = Convert.ToSingle(((ComboBox)sender).Text);
richTextBox1.Font = new Font(richTextBox1.Font.FontFamily, size);
}
This will set the font size of the RichtTextBox (assuming its name is richTextBox1
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.