Font oldFont;
      Font newFont;      // Get the font that is being used in the selected text
      oldFont = this.richTextBoxText.SelectionFont;      // If the font is using Underline style now, we should remove it
      if (oldFont.Underline)
        newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Underline);
      else
        newFont = new Font(oldFont, oldFont.Style | FontStyle.Underline);看不懂这句
oldFont.Style & ~FontStyle.Underline

解决方案 »

  1.   

    &和&&的区别:&是位运算符。&&是布尔逻辑运算符
      

  2.   

    我知道 &&  和~的意思,但这里用是什么意思??
      

  3.   

    oldFont.Style & ~FontStyle.Underline
    ====================================
    在这里这句话的意思就是取得oldFont.Style和不是FontStyle.Underline这个字体的交集。不是FontStyle.Underline就有很多中字体啦,那么这些字体必须oldFont.Style出现才能显示出来。举例:FontStyle.Underline & ~FontStyle.Underline这表示普通字体,因为之间没有交集