取消richtextbox的字体设置
我将一段文字设置为B(粗体),怎么取消B,但要保持其他斜体、下划线的属性(不能使用regular),请问该如何处理
------解决方案--------------------private void button1_Click(object sender, EventArgs e)
{
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style | FontStyle.Bold | FontStyle.Italic);
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style & ~FontStyle.Bold);
}
------解决方案--------------------private void button6_Click(object sender, EventArgs e)
{
if (richTextBox1.SelectionFont.Bold == true)
{
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, richTextBox1.SelectionFont.Style ^ FontStyle.Bold);
}
else
{
richTextBox1.SelectionFont = new Font(richTextBox1.SelectionFont, richTextBox1.SelectionFont.Style | FontStyle.Bold);
}
}
其它同理
------解决方案--------------------学习
------解决方案--------------------又见伴水,已是二星上将了,呼呼,偶争取下周