日期:2014-05-19  浏览次数:20723 次

看不懂这句
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




------解决方案--------------------
oldFont.Style & ~FontStyle.Underline
====================================
在这里这句话的意思就是取得oldFont.Style和不是FontStyle.Underline这个字体的交集。

不是FontStyle.Underline就有很多中字体啦,那么这些字体必须oldFont.Style出现才能显示出来。

举例:FontStyle.Underline & ~FontStyle.Underline这表示普通字体,因为之间没有交集