当前位置: 首页>>代码示例>>C#>>正文


C# Windows.TextDecorationCollection类代码示例

本文整理汇总了C#中System.Windows.TextDecorationCollection的典型用法代码示例。如果您正苦于以下问题:C# TextDecorationCollection类的具体用法?C# TextDecorationCollection怎么用?C# TextDecorationCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextDecorationCollection类属于System.Windows命名空间,在下文中一共展示了TextDecorationCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GameLogWrite

        public void GameLogWrite(String text, SolidColorBrush brush, TextDecorationCollection decorations)
        {
            // FIXME: probably more invalid characters...
            text = text.Replace((Char)0x17, ' ');
            //text = System.Security.SecurityElement.Escape(text).Replace((Char)0x17, ' ');

            XmlElement run = GameLogCreateXmlElement("Run");
            run.InnerText = text;

            Procedure<String, String> addXmlAttribute = (name, value) =>
            {
                XmlAttribute attribute = gameLog.CreateAttribute(name);
                attribute.InnerXml = value;
                run.Attributes.Append(attribute);
            };

            if (brush != Brushes.Black)
            {
                addXmlAttribute("Foreground", brush.ToString());
            }

            if (decorations != null)
            {
                // TODO: fixme for multiple attributes, what's the XML for that?
                addXmlAttribute("TextDecorations", decorations[0].Location.ToString());
            }

            gameLogParagraph.AppendChild(run);
        }
开发者ID:Traderain,项目名称:coldemoplayer,代码行数:29,代码来源:AnalysisWindowInterface.cs

示例2: GenericTextRunProperties

        public GenericTextRunProperties(
            Typeface typeface,
            double size,
            double hintingSize,
            TextDecorationCollection textDecorations,
            Brush forgroundBrush,
            Brush backgroundBrush,
            BaselineAlignment baselineAlignment,
            TextEffectCollection textEffects,
            CultureInfo culture)
        {
            if (typeface == null)
                throw new ArgumentNullException("typeface");

            ValidateCulture(culture);

            _typeface = typeface;
            _emSize = size;
            _emHintingSize = hintingSize;
            _textDecorations = textDecorations;
            _foregroundBrush = forgroundBrush;
            _backgroundBrush = backgroundBrush;
            _baselineAlignment = baselineAlignment;
            _textEffects = textEffects;
            _culture = culture;
        }
开发者ID:erdao,项目名称:Temp,代码行数:26,代码来源:GenericTextRunProperties.cs

示例3: MarkdownHeaderFormatDefinition

 public MarkdownHeaderFormatDefinition()
 {
     IsBold = true;
     TextDecorations = new TextDecorationCollection();
     TextDecorations.Add(new TextDecoration());
     DisplayName = "Markdown Headers";
 }
开发者ID:ncl-dmoreira,项目名称:WebEssentials2013,代码行数:7,代码来源:MarkdownClassificationTypes.cs

示例4: AddAttribute

 public override void AddAttribute(object backend, TextAttribute attribute)
 {
     var t = (TextLayoutBackend)backend;
     if (attribute is FontStyleTextAttribute) {
         var xa = (FontStyleTextAttribute)attribute;
         t.FormattedText.SetFontStyle (xa.Style.ToWpfFontStyle (), xa.StartIndex, xa.Count);
     }
     else if (attribute is FontWeightTextAttribute) {
         var xa = (FontWeightTextAttribute)attribute;
         t.FormattedText.SetFontWeight (xa.Weight.ToWpfFontWeight (), xa.StartIndex, xa.Count);
     }
     else if (attribute is ColorTextAttribute) {
         var xa = (ColorTextAttribute)attribute;
         t.FormattedText.SetForegroundBrush (new SolidColorBrush (xa.Color.ToWpfColor ()), xa.StartIndex, xa.Count);
     }
     else if (attribute is StrikethroughTextAttribute) {
         var xa = (StrikethroughTextAttribute)attribute;
         var dec = new TextDecoration (TextDecorationLocation.Strikethrough, null, 0, TextDecorationUnit.FontRecommended, TextDecorationUnit.FontRecommended);
         TextDecorationCollection col = new TextDecorationCollection ();
         col.Add (dec);
         t.FormattedText.SetTextDecorations (col, xa.StartIndex, xa.Count);
     }
     else if (attribute is UnderlineTextAttribute) {
         var xa = (UnderlineTextAttribute)attribute;
         var dec = new TextDecoration (TextDecorationLocation.Underline, null, 0, TextDecorationUnit.FontRecommended, TextDecorationUnit.FontRecommended);
         TextDecorationCollection col = new TextDecorationCollection ();
         col.Add (dec);
         t.FormattedText.SetTextDecorations (col, xa.StartIndex, xa.Count);
     }
 }
开发者ID:shines77,项目名称:xwt,代码行数:30,代码来源:TextLayoutBackendHandler.cs

示例5: GetTextDecorations

 private TextDecorationCollection GetTextDecorations()
 {
     TextDecorationCollection textDecorations = new TextDecorationCollection();
     if (Strikeout)
         textDecorations.Add(TextDecorations.Strikethrough);
     if (Underline)
         textDecorations.Add(TextDecorations.Underline);
     return textDecorations;
 }
开发者ID:sitdap,项目名称:dynamic-image,代码行数:9,代码来源:Font.cs

示例6: FontRendering

 public FontRendering()
 {
     _fontSize = 12.0f;
     _alignment = TextAlignment.Left;
     _textDecorations = new TextDecorationCollection();
     _textColor = Brushes.Black;
     _typeface = new Typeface(new FontFamily("Arial"),
        FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
 }
开发者ID:abdulbaruwa,项目名称:GapBuffer,代码行数:9,代码来源:FontRendering.cs

示例7: FontProperties

 public FontProperties(TextRange range)
 {
     __FontWeight = range.GetPropertyValue(RichTextBox.FontWeightProperty);
     __FontSize = range.GetPropertyValue(RichTextBox.FontSizeProperty);
     __FontStyle = range.GetPropertyValue(RichTextBox.FontStyleProperty);
     __TextDecorations = range.GetPropertyValue(TextBlock.TextDecorationsProperty) as TextDecorationCollection;
     __FontFamily = range.GetPropertyValue(RichTextBox.FontFamilyProperty) as FontFamily;
     __ForegroundColor = range.GetPropertyValue(RichTextBox.ForegroundProperty) as Brush;
 }
开发者ID:fednep,项目名称:UV-Outliner,代码行数:9,代码来源:FontProperties.cs

示例8: CreateUnderlinedTextBlock

 private TextBlock CreateUnderlinedTextBlock(string text)
 {
     var myUnderline = new TextDecoration
                           {
                               Pen = new Pen(Brushes.Blue, 1),
                               PenThicknessUnit = TextDecorationUnit.FontRecommended
                           };
     var myCollection = new TextDecorationCollection {myUnderline};
     var blockHead = new TextBlock {TextDecorations = myCollection, Text = text};
     return blockHead;
 }
开发者ID:henrybond158,项目名称:elinor,代码行数:11,代码来源:AboutWindow.xaml.cs

示例9: FontRendering

 public FontRendering()
 {
     _fontSize = 64f;
     _alignment = TextAlignment.Left;
     _textDecorations = new TextDecorationCollection();
     _typeface = new Typeface(new FontFamily("Arial"),
        FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
     _foregroundBrush = Brushes.Black;
     _backgroundBrush = Brushes.Transparent;
     _textEffects = new TextEffectCollection();
 }
开发者ID:erdao,项目名称:Temp,代码行数:11,代码来源:FontRendering.cs

示例10: CustomTextRunProperties

			public CustomTextRunProperties(Typeface typeface, double fontSize, Brush foreground, Brush background, bool underline)
			{
				_typeface = typeface;
				_fontSize = fontSize;
				_foreground = foreground;
				_background = background;
				if (underline)
				{
					_decorations = new TextDecorationCollection(1);
					_decorations.Add(System.Windows.TextDecorations.Underline);
				}
			}
开发者ID:derrickcreamer,项目名称:Floe,代码行数:12,代码来源:ChatFormatter.cs

示例11: GetTextBlock

        public TextBlock GetTextBlock(MatchString matchedText, TextDecorationCollection matchDecoration, Brush matchColor)
        {
            TextBlock textBlock = new TextBlock();
            textBlock.HorizontalAlignment = HorizontalAlignment.Left;

            foreach (MatchSubstring matchSubstring in matchedText)
            {
                Run substringControl = new Run(matchSubstring.Value);
                if (matchSubstring.IsMatched)
                {
                    substringControl.TextDecorations = matchDecoration;
                    substringControl.Foreground = matchColor;
                }

                textBlock.Inlines.Add(substringControl);
            }

            return textBlock;
        }
开发者ID:VasiliBaranov,项目名称:navigation-assistant,代码行数:19,代码来源:MatchModelMapper.cs

示例12: ValueEquals

        [FriendAccessAllowed]   // used by Framework
        internal bool ValueEquals(TextDecorationCollection textDecorations)
        {
            if (textDecorations == null) 
                return false;   // o is either null or not TextDecorations object

            if (this == textDecorations) 
                return true;    // Reference equality.

            if ( this.Count != textDecorations.Count)
                return false;   // Two counts are different.

            // To be considered equal, TextDecorations should be same in the exact order.
            // Order matters because they imply the Z-order of the text decorations on screen.
            // Same set of text decorations drawn with different orders may have different result.
            for (int i = 0; i < this.Count; i++)
            {
                if (!this[i].ValueEquals(textDecorations[i]))
                    return false;
            }            
            return true;                     
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:22,代码来源:TextDecorationCollection.cs

示例13: PascalSyntaxHighlighterFormat

        public PascalSyntaxHighlighterFormat()
        {
            var firstCharacterUnderline = new TextDecoration();

            var underlinePen = new Pen
                            {
                                Brush =
                                    new LinearGradientBrush(
                                    Colors.Black, Colors.White, new Point(0.75, 0.5), new Point(1, 0.5)) { Opacity = 0.5 },
                                Thickness = 1.75,
                                DashStyle = DashStyles.Solid
                            };

            firstCharacterUnderline.Pen = underlinePen;
            firstCharacterUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;

            var textDecorations = new TextDecorationCollection { firstCharacterUnderline };
            this.TextDecorations = textDecorations;

            this.DisplayName = "Pascal Syntax Highlighter";
            this.IsBold = true;
        }
开发者ID:rajwilkhu,项目名称:GherkinSyntaxHighlighter,代码行数:22,代码来源:PascalSyntaxHighlighterFormat.cs

示例14: GenericTextRunProperties

 /// <summary>
 /// Constructing TextRunProperties
 /// </summary>
 /// <param name="typeface">typeface</param> 
 /// <param name="size">text size</param>
 /// <param name="hintingSize">text size for Truetype hinting program</param> 
 /// <param name="culture">text culture info</param> 
 /// <param name="textDecorations">TextDecorations </param>
 /// <param name="foregroundBrush">text foreground brush</param> 
 /// <param name="backgroundBrush">highlight background brush</param>
 /// <param name="baselineAlignment">text vertical alignment to its container</param>
 /// <param name="substitution">number substitution behavior to apply to the text; can be null,
 /// in which case the default number substitution method for the text culture is used</param> 
 public GenericTextRunProperties(
     Typeface                 typeface, 
     double                   size, 
     double                   hintingSize,
     TextDecorationCollection textDecorations, 
     Brush                    foregroundBrush,
     Brush                    backgroundBrush,
     BaselineAlignment        baselineAlignment,
     CultureInfo              culture, 
     NumberSubstitution       substitution
 ) 
 { 
      _typeface = typeface;
     _emSize = size; 
     _emHintingSize = hintingSize;
     _textDecorations = textDecorations;
     _foregroundBrush = foregroundBrush;
     _backgroundBrush = backgroundBrush; 
     _baselineAlignment = baselineAlignment;
     _culture = culture; 
     _numberSubstitution = substitution; 
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:35,代码来源:GenericTextProperties.cs

示例15: GetTextDecorationsForInlineObject

        // ----------------------------------------------------------------- 
        // Retrieve text properties from specified inline object.
        // 
        // WORKAROUND: see PS task #13486 & #3399. 
        // For inline object go to its parent and retrieve text decoration
        // properties from there. 
        // ------------------------------------------------------------------
        internal static TextDecorationCollection GetTextDecorationsForInlineObject(DependencyObject element, TextDecorationCollection textDecorations)
        {
            Debug.Assert(element != null); 

            DependencyObject parent = LogicalTreeHelper.GetParent(element); 
            TextDecorationCollection parentTextDecorations = null; 

            if (parent != null) 
            {
                // Get parent text decorations if it is non-null
                parentTextDecorations = GetTextDecorations(parent);
            } 

            // see if the two text decorations are equal. 
            bool textDecorationsEqual = (textDecorations == null) ? 
                                         parentTextDecorations == null
                                       : textDecorations.ValueEquals(parentTextDecorations); 

            if (!textDecorationsEqual)
            {
                if (parentTextDecorations == null) 
                {
                    textDecorations = null; 
                } 
                else
                { 
                    textDecorations = new TextDecorationCollection();
                    int count = parentTextDecorations.Count;
                    for (int i = 0; i < count; ++i)
                    { 
                        textDecorations.Add(parentTextDecorations[i]);
                    } 
                } 
            }
            return textDecorations; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:43,代码来源:DynamicPropertyReader.cs


注:本文中的System.Windows.TextDecorationCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。