首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

看不懂这句解决思路

2012-02-25 
看不懂这句FontoldFontFontnewFont//GetthefontthatisbeingusedintheselectedtextoldFontthis.richText

看不懂这句
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这表示普通字体,因为之间没有交集

热点排行