本文整理汇总了C#中IHTMLItem.EstimateSize方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLItem.EstimateSize方法的具体用法?C# IHTMLItem.EstimateSize怎么用?C# IHTMLItem.EstimateSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLItem
的用法示例。
在下文中一共展示了IHTMLItem.EstimateSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SplitSimpleHTMLItem
private ulong SplitSimpleHTMLItem(IHTMLItem splitedItem, Div content, IList<IHTMLItem> resList, ulong documentSize)
{
ulong docSize = documentSize;
ulong itemSize = splitedItem.EstimateSize();
if (_checker.ExceedSizeLimit(documentSize + itemSize))
{
var oldContent = content;
resList.Add(content);
content = new Div(HTMLElementType.HTML5);
content.GlobalAttributes.Class.Value = oldContent.GlobalAttributes.Class.Value;
content.GlobalAttributes.Language.Value = oldContent.GlobalAttributes.Language.Value;
docSize = 0;
}
if (!_checker.ExceedSizeLimit(itemSize)) // if we can "fit" element into a max size XHTML document
{
docSize += itemSize;
content.Add(splitedItem);
}
return docSize;
}
示例2: SplitBlockHTMLItem
private ulong SplitBlockHTMLItem(IHTMLItem item, Div content, IList<IHTMLItem> resList, ulong documentSize)
{
ulong docSize = documentSize;
ulong itemSize = item.EstimateSize();
if (_checker.ExceedSizeLimit(documentSize + itemSize))
{
var oldContent = content;
resList.Add(content);
content = new Div(HTMLElementType.HTML5);
content.GlobalAttributes.Class.Value = oldContent.GlobalAttributes.Class.Value;
content.GlobalAttributes.Language.Value = oldContent.GlobalAttributes.Language.Value;
docSize = 0;
}
if (!_checker.ExceedSizeLimit(itemSize)) // if we can "fit" element into a max size XHTML document
{
docSize += itemSize;
content.Add(item);
}
else
{
var div = item as Div;
if (div != null) // if the item that bigger than max size is Div block
{
foreach (var splitedItem in SplitDiv(div, documentSize))
{
documentSize = SplitSimpleHTMLItem(splitedItem, content, resList, documentSize);
}
}
}
return docSize;
}