• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# TextFormatting.TextRunProperties类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetTextRunProperties

        public TextRunProperties GetTextRunProperties(TextRunProperties defaultTextRunProperties)
        {
            var item = (CompletionItem as DescriptionModifyingCompletionItem)?.CompletionItem ?? CompletionItem;

            return (item.CompletionProvider as ICustomCompletionItemFormatter)?.GetTextRunProperties(item, defaultTextRunProperties) 
                ?? defaultTextRunProperties;
        }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:7,代码来源:CustomCommitCompletion.cs


示例2: Update

        internal void Update(
            string text,
            ITextViewLine line,
            IWpfTextView view,
            TextRunProperties formatting,
            double marginWidth,
            double verticalOffset)
        {
            LineTag = line.IdentityTag;

            if (_text == null || !string.Equals(_text, text, StringComparison.Ordinal))
            {
                _text = text;
                _formattedText = new FormattedText(
                    _text,
                    CultureInfo.InvariantCulture,
                    FlowDirection.LeftToRight,
                    formatting.Typeface,
                    formatting.FontRenderingEmSize,
                    formatting.ForegroundBrush);

                _horizontalOffset = Math.Round(marginWidth - _formattedText.Width);
                InvalidateVisual();
            }

            var num = line.TextTop - view.ViewportTop + verticalOffset;
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (num == _verticalOffset) return;
            _verticalOffset = num;
            InvalidateVisual();
        }
开发者ID:kazu46,项目名称:VSColorOutput,代码行数:31,代码来源:TimeStampVisual.cs


示例3: GetGlobalTextRunProperties

        public static TextRunProperties GetGlobalTextRunProperties() {
            if (textRunProperties == null) {
                textRunProperties = CreateGlobalTextRunProperties();
            }

            return textRunProperties;
        }
开发者ID:mmalek06,项目名称:FunkyCodeEditor,代码行数:7,代码来源:TextConfiguration.cs


示例4: Equals

		public static bool Equals(TextRunProperties a, TextRunProperties b) {
			if (a == b)
				return true;
			if (a == null || b == null)
				return false;

			if (a.FontHintingEmSize != b.FontHintingEmSize)
				return false;
			if (a.FontRenderingEmSize != b.FontRenderingEmSize)
				return false;
			if (a.TextDecorations != b.TextDecorations)	// We don't use it so this is enough
				return false;
			if (a.TextEffects != b.TextEffects) // We don't use it so this is enough
				return false;
			if (!a.CultureInfo.Equals(b.CultureInfo))
				return false;
			if (!a.Typeface.Equals(b.Typeface))
				return false;
			if (!Equals(a.BackgroundBrush, b.BackgroundBrush))
				return false;
			if (!Equals(a.ForegroundBrush, b.ForegroundBrush))
				return false;
			if (a.BaselineAlignment != b.BaselineAlignment)
				return false;
			if (!Equals(a.NumberSubstitution, b.NumberSubstitution))
				return false;
			if (!Equals(a.TypographyProperties, b.TypographyProperties))
				return false;

			return true;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:31,代码来源:HexTextRunProperties.cs


示例5: UpdateVisual

        /// <summary>
        /// Store <paramref name="timeStamp"/> and updates the text for the visual.
        /// </summary>
        /// <param name="timeStamp">Time of the event.</param>
        /// <param name="line">The line that this time stamp corresponds to.</param>
        /// <param name="view">The <see cref="IWpfTextView"/> to whom the <paramref name="line"/> belongs.</param>
        /// <param name="formatting">Properties for the time stamp text.</param>
        /// <param name="marginWidth">Used to calculate the horizontal offset for <see cref="OnRender(DrawingContext)"/>.</param>
        /// <param name="verticalOffset">Used to calculate the vertical offset for <see cref="OnRender(DrawingContext)"/>.</param>
        /// <param name="showHours">Option to show hours on the time stamp.</param>
        /// <param name="showMilliseconds">Option to show milliseconds on the time stamp.</param>
        internal void UpdateVisual(DateTime timeStamp, ITextViewLine line, IWpfTextView view, TextRunProperties formatting, double marginWidth, double verticalOffset,
                                   bool showHours, bool showMilliseconds)
        {
            this.LineTag = line.IdentityTag;

            if (timeStamp != this.TimeStamp)
            {
                this.TimeStamp = timeStamp;
                string text = GetFormattedTime(timeStamp, showHours, showMilliseconds);
                TextFormattingMode textFormattingMode = view.FormattedLineSource.UseDisplayMode ? TextFormattingMode.Display : TextFormattingMode.Ideal;
                _text = new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight,
                                          formatting.Typeface, formatting.FontRenderingEmSize, formatting.ForegroundBrush,
                                          InvariantNumberSubstitution, textFormattingMode);

                _horizontalOffset = Math.Round(marginWidth - _text.Width);
                this.InvalidateVisual(); // force redraw
            }

            double newVerticalOffset = line.TextTop - view.ViewportTop + verticalOffset;
            if (newVerticalOffset != _verticalOffset)
            {
                _verticalOffset = newVerticalOffset;
                this.InvalidateVisual(); // force redraw
            }
        }
开发者ID:xornand,项目名称:VS-PPT,代码行数:36,代码来源:TimeStampVisual.cs


示例6: ModifyProperties

        /// <summary>
        /// Modifies the properties of a text run.
        /// </summary>
        /// <param name="properties">Properties of a text run or the return value of
        /// ModifyProperties for a nested text modifier.</param>
        /// <returns>Returns the actual text run properties to be used for formatting,
        /// subject to further modification by text modifiers at outer scopes.</returns>
        public sealed override TextRunProperties ModifyProperties(TextRunProperties properties)
        {
            // Get the text decorations applied to the text modifier run. If there are
            // none, we don't change anything.
            if (properties == null || _modifierDecorations == null || _modifierDecorations.Count == 0)
                return properties;        

            // Let brush be the foreground brush for the text modifier run. Any text
            // decorations defined at the text modifier scope that have a null Pen
            // should be drawn using this brush, which means we may need to copy some
            // TextDecoration objects and set the Pen property on the copies. We can
            // elide this if the same brush is used at both scopes. We shouldn't miss
            // too many optimization opportunities by using the (lower cost) reference
            // comparison here because in most cases where the brushes are equal it's
            // because it's an inherited property.
            Brush brush = _modifierBrush;
            if (object.ReferenceEquals(brush, properties.ForegroundBrush))
            {
                // No need to set the pen property.
                brush = null;
            }

            // We're going to create a merged set of text decorations.
            TextDecorationCollection mergedDecorations;

            // Get the text decorations of the affected run, if any.
            TextDecorationCollection runDecorations = properties.TextDecorations;
            if (runDecorations == null || runDecorations.Count == 0)
            {
                // Only the text modifier run defines text decorations so
                // we don't need to merge anything.
                if (brush == null)
                {
                    // Use the text decorations of the modifier run.
                    mergedDecorations = _modifierDecorations;
                }
                else
                {
                    // The foreground brushes differ so copy the text decorations to a
                    // new collection and make sure each has a non-null pen.
                    mergedDecorations = CopyTextDecorations(_modifierDecorations, brush);
                }
            }
            else
            {
                // Add the modifier decorations first because we want text decorations
                // defined at the inner scope (e.g., by the run) to be drawn on top.
                mergedDecorations = CopyTextDecorations(_modifierDecorations, brush);

                // Add the text decorations defined at the inner scope; we never need
                // to set the pen for these because they should be drawn using the
                // foreground brush.
                foreach (TextDecoration td in runDecorations)
                {
                    mergedDecorations.Add(td);
                }
            }

            return new MergedTextRunProperties(properties, mergedDecorations);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:67,代码来源:TextSpanModifier.cs


示例7: TextTrailingWordEllipsis

 /// <summary>
 /// Construct a text trailing word ellipsis collapsing properties
 /// </summary>
 /// <param name="width">width in which collapsing is constrained to</param>
 /// <param name="textRunProperties">text run properties of ellispis symbol</param>
 public TextTrailingWordEllipsis(
     double              width,
     TextRunProperties   textRunProperties
     )
 {
     _width = width;
     _ellipsis = new TextCharacters(StringHorizontalEllipsis, textRunProperties);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:TextTrailingWordEllipsis.cs


示例8: GetLine

 protected TextLine GetLine(TextRunProperties runProperties, TextSource textSource, int column = 0) {
     return TextFormatter.Create().FormatLine(
         textSource,
         column,
         96 * 6,
         new SimpleParagraphProperties { defaultTextRunProperties = runProperties },
         null);
 }
开发者ID:mmalek06,项目名称:FunkyCodeEditor,代码行数:8,代码来源:VisualElementSymbolBase.cs


示例9: InlineObjectRun

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cch">Number of text position in the text array occupied by the inline object.</param>
        /// <param name="element">UIElement representing the inline object.</param>
        /// <param name="textProps">Text run properties for the inline object.</param>
        /// <param name="host">Paragraph - the host of the inline object.</param>
        internal InlineObjectRun(int cch, UIElement element, TextRunProperties textProps, TextParagraph host)
        {
            _cch = cch;
            _textProps = textProps;
            _host = host;

            _inlineUIContainer = (InlineUIContainer)LogicalTreeHelper.GetParent(element);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:15,代码来源:RunClient.cs


示例10: InlineObject

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="dcp">Text position of the inline object in the text array.</param>
 /// <param name="cch">Number of text position in the text array occupied by the inline object.</param>
 /// <param name="element">UIElement representing the inline object.</param>
 /// <param name="textProps">Text run properties for the inline object.</param>
 /// <param name="host">TextBlock element - the host of the inline object.</param>
 internal InlineObject(int dcp, int cch, UIElement element, TextRunProperties textProps, System.Windows.Controls.TextBlock host)
 {
     _dcp = dcp;
     _cch = cch;
     _element = element;
     _textProps = textProps;
     _host = host;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:16,代码来源:InlineObject.cs


示例11: ModifyProperties

 /// <summary>
 /// Modifies the specified text run properties by invoking the modifier at
 /// the current scope and all containing scopes.
 /// </summary>
 /// <param name="properties">Properties to modify.</param>
 /// <returns>Returns the text run properties after modification.</returns>
 internal TextRunProperties ModifyProperties(TextRunProperties properties)
 {
     for (TextModifierScope scope = this; scope != null; scope = scope._parentScope)
     {
         properties = scope._modifier.ModifyProperties(properties);
     }
     return properties;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:14,代码来源:TextModifierScope.cs


示例12: FormattedTextRun

		/// <summary>
		/// Creates a new FormattedTextRun.
		/// </summary>
		public FormattedTextRun(FormattedTextElement element, TextRunProperties properties)
		{
			if (element == null)
				throw new ArgumentNullException("element");
			if (properties == null)
				throw new ArgumentNullException("properties");
			this.properties = properties;
			this.element = element;
		}
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:FormattedTextElement.cs


示例13: TextEndOfParagraph

 /// <summary>
 /// Construct a paragraph break run
 /// </summary>
 /// <param name="length">number of characters</param>
 /// <param name="textRunProperties">linebreak text run properties</param>
 public TextEndOfParagraph(
     int                 length, 
     TextRunProperties   textRunProperties
     )
     : base(
         length, 
         textRunProperties
         )
 {}
开发者ID:JianwenSun,项目名称:cc,代码行数:14,代码来源:TextEndOfParagraph.cs


示例14: GetFormattedText

 protected FormattedText GetFormattedText(string text, TextRunProperties runProperties) {
     return new FormattedText(
         text,
         CultureInfo.CurrentUICulture,
         FlowDirection.LeftToRight,
         runProperties.Typeface,
         runProperties.FontRenderingEmSize,
         Brushes.Black);
 }
开发者ID:mmalek06,项目名称:FunkyCodeEditor,代码行数:9,代码来源:VisualElementSymbolBase.cs


示例15: HexLinePart

		public HexLinePart(int index, int column, VST.Span span, TextRunProperties textRunProperties) {
			Debug.Assert(!span.IsEmpty);
			Debug.Assert(textRunProperties != null);
			Index = index;
			Column = column;
			Span = span;
			AdornmentElement = null;
			TextRunProperties = textRunProperties;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:HexLinePart.cs


示例16: HexTextRunProperties

		public HexTextRunProperties(TextRunProperties other) {
			this._BackgroundBrush = other.BackgroundBrush;
			this._CultureInfo = other.CultureInfo;
			this._FontHintingEmSize = other.FontHintingEmSize;
			this._FontRenderingEmSize = other.FontRenderingEmSize;
			this._ForegroundBrush = other.ForegroundBrush;
			this._TextDecorations = other.TextDecorations;
			this._TextEffects = other.TextEffects;
			this._Typeface = other.Typeface;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:10,代码来源:HexTextRunProperties.cs


示例17: TextCharacters

 /// <summary>
 /// Construct a run for text content from string 
 /// </summary>
 public TextCharacters(
     string                      characterString,
     TextRunProperties           textRunProperties
     ) : 
     this(
         characterString,
         0,  // offserToFirstChar
         (characterString == null) ? 0 : characterString.Length,
         textRunProperties
         )
 {}
开发者ID:JianwenSun,项目名称:cc,代码行数:14,代码来源:TextCharacters.cs


示例18: InlineObjectRun

        /// <summary>
        /// Creates a new InlineObjectRun instance.
        /// </summary>
        /// <param name="length">The length of the TextRun.</param>
        /// <param name="properties">The <see cref="TextRunProperties"/> to use.</param>
        /// <param name="element">The <see cref="UIElement"/> to display.</param>
        public InlineObjectRun(int length, TextRunProperties properties, UIElement element)
        {
            if (length <= 0)
                throw new ArgumentOutOfRangeException("length", length, "Value must be positive");
            if (properties == null)
                throw new ArgumentNullException("properties");
            if (element == null)
                throw new ArgumentNullException("element");

            this.length = length;
            this.properties = properties;
            this.element = element;
        }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:19,代码来源:InlineObjectRun.cs


示例19: TextEndOfLine

        /// <summary>
        /// Construct a linebreak run
        /// </summary>
        /// <param name="length">number of characters</param>
        /// <param name="textRunProperties">linebreak text run properties</param>
        public TextEndOfLine(
            int                 length, 
            TextRunProperties   textRunProperties
            )
        {
            if (length <= 0)
                throw new ArgumentOutOfRangeException("length", SR.Get(SRID.ParameterMustBeGreaterThanZero));

            if (textRunProperties != null && textRunProperties.Typeface == null)
                throw new ArgumentNullException("textRunProperties.Typeface");

            _length = length;
            _textRunProperties = textRunProperties;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:19,代码来源:TextEndOfLine.cs


示例20: GenericTextParagraphProperties

 public GenericTextParagraphProperties(FontRendering newRendering)
 {
     _flowDirection = FlowDirection.LeftToRight;
     _textAlignment = newRendering.TextAlignment;
     _firstLineInParagraph = false;
     _alwaysCollapsible = false;
     _defaultTextRunProperties = new GenericTextRunProperties(
        newRendering.Typeface, newRendering.FontSize, newRendering.FontSize,
        newRendering.TextDecorations, newRendering.TextColor, null,
        BaselineAlignment.Baseline, CultureInfo.CurrentUICulture);
     _textWrap = TextWrapping.Wrap;
     _lineHeight = 0;
     _indent = 0;
     _paragraphIndent = 0;
 }
开发者ID:abdulbaruwa,项目名称:GapBuffer,代码行数:15,代码来源:GenericTextProperties.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Navigation.NavigatingCancelEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# TextFormatting.TextLine类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap