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


C# Documents.Inline类代码示例

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


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

示例1: _AddLineImpl

 protected override void _AddLineImpl( Inline inline )
 {
     FlowDocument.Blocks.Add( new Paragraph( inline ) {
         Background = Brushes.MediumBlue,
         Foreground = Brushes.White,
     } );
 }
开发者ID:BGCX261,项目名称:ziveirc-svn-to-git,代码行数:7,代码来源:ScrollbackDebugManager.cs

示例2: OnHtmlTextChanged

        private static void OnHtmlTextChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
        {
            // Go ahead and return out if we set the property on something other than a textblock, or set a value that is not a string.
            var txtBox = depObj as TextBlock;
            if(txtBox == null)
                return;
            if(!(e.NewValue is string))
                return;
            var html = e.NewValue as string;
            string xaml;
            InlineCollection xamLines;

            try {

                xaml = HtmlToXamlConverter.ConvertHtmlToXaml(html, false);
                xamLines = ((Paragraph)((Section)System.Windows.Markup.XamlReader.Parse(xaml)).Blocks.FirstBlock).Inlines;

            } catch {
                // There was a problem parsing the html, return out.
                return;
            }
            // Create a copy of the Inlines and add them to the TextBlock.
            Inline[] newLines = new Inline[xamLines.Count];
            xamLines.CopyTo(newLines, 0);

            txtBox.Inlines.Clear();
            foreach(var l in newLines) {
                txtBox.Inlines.Add(l);
            }
        }
开发者ID:mrtska,项目名称:SRNicoNico,代码行数:30,代码来源:TextBlockHtmlBehavior.cs

示例3: GetInlines

        private Inline[] GetInlines()
        {
            Inline[] inlines = new Inline[3];

            Match firstMatch = _result.TextMatches[0];
            string sourceText = _result.SourceText;

            int startIndex = Math.Max(0, firstMatch.Index - CHARS_TO_INCLUDE);
            string prev = sourceText.Substring(startIndex, firstMatch.Index - startIndex);
            inlines[0] = new Run()
            {
                Text = prev,
                Foreground = new SolidColorBrush(Colors.Gray)
            };

            string match = firstMatch.Value;
            inlines[1] = new Run()
            {
                Text = match,
                Foreground = (Brush)App.Current.Resources["PhoneForegroundBrush"]
            };

            startIndex = firstMatch.Index + firstMatch.Value.Length;
            int length = Math.Min(sourceText.Length - startIndex, CHARS_TO_INCLUDE);
            string after = sourceText.Substring(startIndex, length);
            inlines[2] = new Run()
            {
                Text = after,
                Foreground = new SolidColorBrush(Colors.Gray)
            };

            return inlines;
        }
开发者ID:hmehart,项目名称:Notepad,代码行数:33,代码来源:SearchResultListItem2.cs

示例4: Span

        /// <summary>
        /// Creates a new Span instance.
        /// </summary>
        /// <param name="childInline">
        /// Optional child Inline for the new Span.  May be null.
        /// </param>
        /// <param name="insertionPosition">
        /// Optional position at which to insert the new Span.  May be null.
        /// </param>
        public Span(Inline childInline, TextPointer insertionPosition)
        {
            if (insertionPosition != null)
            {
                insertionPosition.TextContainer.BeginChange();
            }
            try
            {
                if (insertionPosition != null)
                {
                    // This will throw InvalidOperationException if schema validity is violated.
                    insertionPosition.InsertInline(this);
                }

                if (childInline != null)
                {
                    this.Inlines.Add(childInline);
                }
            }
            finally
            {
                if (insertionPosition != null)
                {
                    insertionPosition.TextContainer.EndChange();
                }
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:36,代码来源:Span.cs

示例5: InlineTweetView

        public InlineTweetView(Inline body, Tweet tweet)
            : this()
        {
            _tweet = tweet;
            _body.Inlines.Add(body);

            DataContext = this;
        }
开发者ID:Doomblaster,项目名称:MetroFire,代码行数:8,代码来源:InlineTweetView.xaml.cs

示例6: Insert

        public static Inline Insert(this Inline inline, Inline inlineToAdd)
        {
            var span = inline as Span ?? new Span(inline);

            span.Inlines.Add(inlineToAdd);

            return span;
        }
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:8,代码来源:InlineExtensions.cs

示例7: Append

        public static Inline Append(this Inline inline, Inline inlineToAdd)
        {
            var span = new Span(inline);

            span.Inlines.Add(inlineToAdd);

            return span;
        }
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:8,代码来源:InlineExtensions.cs

示例8: TerminalControl

        public TerminalControl()
        {
            InitializeComponent();

            caretInline = Input.Inlines.LastInline;

            RTB.PreviewMouseDown += OnControlMouseDown;
            //TextReceiver.TextChanged += TextChanged;
        }
开发者ID:anaimi,项目名称:farawla,代码行数:9,代码来源:TerminalControl.xaml.cs

示例9: AddIfNotNull

        public static void AddIfNotNull(this InlineCollection inlineCollection, Inline inline)
        {
            if (inline == null)
            {
                return;
            }

            inlineCollection.Add(inline);
        }
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:9,代码来源:InlineCollectionExtensions.cs

示例10: routeHyperlinks

		void routeHyperlinks(Inline inl)
		{
			if (inl is Hyperlink)
				(inl as Hyperlink).RequestNavigate += (s, e) => App.Current.OnRequestNavigate(s, e);

			if (inl is Span)
				foreach (var sub in (inl as Span).Inlines)
					routeHyperlinks(sub);
		}
开发者ID:ace13,项目名称:FList-sharp,代码行数:9,代码来源:MessageList.xaml.cs

示例11: InsertInspectedResult

 public Inline InsertInspectedResult(Inline position, object obj)
 {
     LoadInspector(obj);
     object result = _rubyEngine.InvokeMember(obj, "as_xaml");
     if (result is MutableString) {
         return InsertColorizedCode(position, result.ToString());
     } else {
         throw new NotImplementedError("do not have mechanism to insert UIElement in middle of flow document yet");
     }
 }
开发者ID:jflam,项目名称:repl-lib,代码行数:10,代码来源:Repl.xaml.cs

示例12: Paragraph

        /// <summary>
        /// Paragraph constructor.
        /// </summary>
        public Paragraph(Inline inline)
            : base()
        {
            if (inline == null)
            {
                throw new ArgumentNullException("inline");
            }

            this.Inlines.Add(inline);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:13,代码来源:Paragraph.cs

示例13: RemoveHyperlink

        public static TextPointer RemoveHyperlink(TextPointer start)
        {
            var backspacePosition = start.GetNextInsertionPosition(LogicalDirection.Backward);
            Hyperlink hyperlink;
            if (backspacePosition == null || !IsHyperlinkBoundaryCrossed(start, backspacePosition, out hyperlink))
            {
                return null;
            }

            // Remember caretPosition with forward gravity. This is necessary since we are going to delete
            // the hyperlink element preceeding caretPosition and after deletion current caretPosition
            // (with backward gravity) will follow content preceeding the hyperlink.
            // We want to remember content following the hyperlink to set new caret position at.

            var newCaretPosition = start.GetPositionAtOffset(0, LogicalDirection.Forward);

            // Deleting the hyperlink is done using logic below.

            // 1. Copy its children Inline to a temporary array.
            var hyperlinkChildren = hyperlink.Inlines;
            var inlines = new Inline[hyperlinkChildren.Count];
            hyperlinkChildren.CopyTo(inlines, 0);

            // 2. Remove each child from parent hyperlink element and insert it after the hyperlink.
            for (int i = inlines.Length - 1; i >= 0; i--)
            {
                hyperlinkChildren.Remove(inlines[i]);
                hyperlink.SiblingInlines.InsertAfter(hyperlink, inlines[i]);
            }

            // 3. Apply hyperlink's local formatting properties to inlines (which are now outside hyperlink scope).
            var localProperties = hyperlink.GetLocalValueEnumerator();
            var inlineRange = new TextRange(inlines[0].ContentStart, inlines[inlines.Length - 1].ContentEnd);

            while (localProperties.MoveNext())
            {
                var property = localProperties.Current;
                var dp = property.Property;
                object value = property.Value;

                if (!dp.ReadOnly &&
                    dp != Inline.TextDecorationsProperty && // Ignore hyperlink defaults.
                    dp != TextElement.ForegroundProperty &&
                    dp != BaseUriHelper.BaseUriProperty &&
                    !IsHyperlinkProperty(dp))
                {
                    inlineRange.ApplyPropertyValue(dp, value);
                }
            }

            // 4. Delete the (empty) hyperlink element.
            hyperlink.SiblingInlines.Remove(hyperlink);

            return newCaretPosition;
        }
开发者ID:JackWangCUMT,项目名称:Plainion,代码行数:55,代码来源:DocumentFacade.cs

示例14: LookupHyperlinks

 private static void LookupHyperlinks(Inline inline)
 {
     if (inline is Hyperlink)
     {
         var hyperlink = ((Hyperlink) inline);
         hyperlink.RequestNavigate += HyperlinkRequestNavigate;
     }
     if (inline is Span)
         foreach (Inline subInline in ((Span) inline).Inlines)
             LookupHyperlinks(subInline);
 }
开发者ID:eNoise,项目名称:UruchieForumGadget,代码行数:11,代码来源:HtmlToFlowDocumentConverter.cs

示例15: Append

        public static Inline Append(this Inline inline, Inline inlineToAdd)
        {
            Argument.IsNotNull(() => inline);
            Argument.IsNotNull(() => inlineToAdd);

            var span = new Span(inline);

            span.Inlines.Add(inlineToAdd);

            return span;
        }
开发者ID:sk8tz,项目名称:Orc.Controls,代码行数:11,代码来源:InlineExtensions.cs


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