wpf去掉下滑线

来源:互联网 发布:php split explode 编辑:程序博客网 时间:2024/04/30 04:34

  if (styleChange3 == 1)
                        {
                            App.winBoard.rtxtTest.Selection.ApplyPropertyValue(Paragraph.TextDecorationsProperty, TextDecorations.Underline);//下划线
                            styleChange3 = 0;//有下划线
                        }
                        else if (styleChange3 == 0)
                        {
                            TextDecoration myUnderline = new TextDecoration();//声明一个下滑线变量
                            Pen myPen = new Pen();// 声明一个画笔
                            myPen.Brush = new LinearGradientBrush();
                            myPen.Brush.Opacity = 0;//设置全透明
                            myUnderline.Pen = myPen;
                            myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
                            TextDecorationCollection myCollection = new TextDecorationCollection();
                            myCollection.Add(myUnderline);
                            App.winBoard.rtxtTest.Selection.ApplyPropertyValue(Paragraph.TextDecorationsProperty, myCollection);//去掉下滑线
                            styleChange3 = 1;
                        }

原创粉丝点击