本文整理汇总了C#中System.Windows.Documents.DocumentNode.ConstrainFontPropagation方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentNode.ConstrainFontPropagation方法的具体用法?C# DocumentNode.ConstrainFontPropagation怎么用?C# DocumentNode.ConstrainFontPropagation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.DocumentNode
的用法示例。
在下文中一共展示了DocumentNode.ConstrainFontPropagation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WrapInlineInParagraph
internal void WrapInlineInParagraph(int nInsertAt, int nChildren)
{
DocumentNodeArray dna = _converterState.DocumentNodeArray;
Debug.Assert(nInsertAt >= 0 && nChildren > 0 && nInsertAt + nChildren - 1 < dna.Count);
DocumentNode dnChild = dna.EntryAt(nInsertAt + nChildren - 1);
DocumentNode dn = new DocumentNode(DocumentNodeType.dnParagraph);
dn.FormatState = new FormatState(dnChild.FormatState);
dn.ConstrainFontPropagation(dn.FormatState);
DocumentNode dnParent = null;
// Parent shouldn't be the child of new inserted document node
// to avoid the infinite loop on InsertChildAt()
if (dnChild.ClosedParent != null
&& dnChild.ClosedParent.Index < nInsertAt
&& dnChild.ClosedParent.Index > (nInsertAt + nChildren - 1))
{
dnParent = dnChild.ClosedParent;
}
dna.InsertChildAt(dnParent, dn, nInsertAt, nChildren);
dna.CoalesceOnlyChildren(_converterState, nInsertAt);
}
示例2: HandleParagraphFromText
internal void HandleParagraphFromText(FormatState formatState)
{
DocumentNodeArray dna = _converterState.DocumentNodeArray;
DocumentNode dn;
// Insert the paragraph before any text or inline nodes at the top of the stack.
int nInsertAt = dna.Count; // Default insertion location
for (; nInsertAt > 0; nInsertAt--)
{
dn = dna.EntryAt(nInsertAt - 1);
if (!dn.IsInline
|| (dn.ClosedParent != null && !dn.ClosedParent.IsInline)
|| !dn.IsMatched)
{
break;
}
}
dn = new DocumentNode(DocumentNodeType.dnParagraph);
dn.FormatState = new FormatState(formatState);
dn.ConstrainFontPropagation(formatState);
dna.InsertNode(nInsertAt, dn);
// Now close immediately.
dna.CloseAt(nInsertAt);
dna.CoalesceOnlyChildren(_converterState, nInsertAt);
}