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


C# Inline.GetType方法代码示例

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


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

示例1: FormatInline

 public void FormatInline(FlowDocument doc, Inline inline, StringBuilder buf, int indent)
 {
     // indent
      buf.Append (' ', indent);
      buf.AppendFormat (
     "{0} {1} to {2}",
     inline.GetType ().Name + inline.GetHashCode (),
     inline.ContentStart.CompareTo (doc.ContentStart),
     inline.ContentEnd.CompareTo (doc.ContentStart));
      if (inline is Run)
      {
     buf.Append ("  \"" + ((Run)inline).Text + "\"");
      }
      buf.AppendLine ();
      if (inline is Underline)
      {
     FormatInlines (doc, ((Underline)inline).Inlines,  buf, indent + 3);
      }
      if (inline is Italic)
      {
     FormatInlines (doc, ((Italic)inline).Inlines,  buf, indent + 3);
      }
 }
开发者ID:jeremyrsellars,项目名称:recipe,代码行数:23,代码来源:ViewRecipe.xaml.cs

示例2: InsertInline

        // Inserts an Inline at the current location, adding contextual
        // elements as needed to enforce the schema.
        internal void InsertInline(Inline inline)
        {
            TextPointer position = this;

            // Check for hyperlink schema validity first -- we'll throw on an illegal Hyperlink descendent insert.
            bool isValidChild = TextSchema.ValidateChild(position, /*childType*/inline.GetType(), false /* throwIfIllegalChild */, true /* throwIfIllegalHyperlinkDescendent */);

            // Now, it is safe to assume that !isValidChild will be the case of incomplete content.
            if (!isValidChild)
            {
                if (position.Parent == null)
                {
                    // 
                    throw new InvalidOperationException(SR.Get(SRID.TextSchema_CannotInsertContentInThisPosition));
                }

                // Ensure text content.
                position = TextRangeEditTables.EnsureInsertionPosition(this);
                Invariant.Assert(position.Parent is Run, "EnsureInsertionPosition() must return a position in text content");
                Run run = (Run)position.Parent;

                if (run.IsEmpty)
                {
                    // Remove the implicit (empty) Run, since we are going to insert an inline at this position.
                    run.RepositionWithContent(null);
                }
                else
                {
                    // Position is parented by Run, split formatting elements to prepare for inserting inline at this position.
                    position = TextRangeEdit.SplitFormattingElement(position, /*keepEmptyFormatting:*/false);
                }

                Invariant.Assert(TextSchema.IsValidChild(position, /*childType*/inline.GetType()));
            }

            inline.RepositionWithContent(position);
        }
开发者ID:mind0n,项目名称:hive,代码行数:39,代码来源:TextPointer.cs


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