本文整理汇总了C#中mshtml.parentElement方法的典型用法代码示例。如果您正苦于以下问题:C# mshtml.parentElement方法的具体用法?C# mshtml.parentElement怎么用?C# mshtml.parentElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mshtml
的用法示例。
在下文中一共展示了mshtml.parentElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveHTML
private void RemoveHTML(GlobalSettings settings,mshtml.IHTMLTxtRange range)
{
mshtml.IHTMLElement element = range.parentElement();
if (settings.IsHightlightNonVisible)
{
if (settings.IsBold)
{
if (settings.IsItalic)
{
RemoveBIS(element);
}
else
{
RemoveBS(element);
}
}
else
{
if (settings.IsItalic)
{
RemoveIS(element);
}
else
{
RemoveS(element);
}
}
}
else
{
if (element.offsetTop > Const.NotFound && element.offsetLeft > Const.NotFound && element.offsetHeight > Const.Ok && element.offsetWidth > Const.Ok)
{
if (settings.IsBold)
{
if (settings.IsItalic)
{
RemoveBIS(element);
}
else
{
RemoveBS(element);
}
}
else
{
if (settings.IsItalic)
{
RemoveIS(element);
}
else
{
RemoveS(element);
}
}
}
}
Marshal.ReleaseComObject(element);
}
示例2: BuildHTML
private String BuildHTML(GlobalSettings settings,mshtml.IHTMLTxtRange range)
{
string background = settings.BackgroundColor.R.ToString("X2") + settings.BackgroundColor.G.ToString("X2") + settings.BackgroundColor.B.ToString("X2");
string textColor = settings.TextColor.R.ToString("X2") + settings.TextColor.G.ToString("X2") + settings.TextColor.B.ToString("X2");
bool isEmpty = false;
StringBuilder builder = new StringBuilder();
builder.Append("<span id=advanced_search style=\"background:#");
builder.Append(background);
builder.Append("; color:#");
builder.Append(textColor);
builder.Append("\">");
if (settings.IsHightlightNonVisible)
{
if (settings.IsItalic)
{
if (settings.IsBold)
{
builder.Append("<i><b>");
builder.Append(range.text);
builder.Append("</b></i></span>");
}
else
{
builder.Append("<i>");
builder.Append(range.text);
builder.Append("</i></span>");
}
}
else
{
if (settings.IsBold)
{
builder.Append("<b>");
builder.Append(range.text);
builder.Append("</b></span>");
}
else
{
builder.Append(range.text);
builder.Append("</span>");
}
}
}
else
{
mshtml.IHTMLElement element = range.parentElement();
if (element.offsetTop > Const.NotFound && element.offsetLeft > Const.NotFound && element.offsetHeight > Const.Ok && element.offsetWidth > Const.Ok)
{
if (settings.IsItalic)
{
if (settings.IsBold)
{
builder.Append("<i><b>");
builder.Append(range.text);
builder.Append("</b></i></span>");
}
else
{
builder.Append("<i>");
builder.Append(range.text);
builder.Append("</i></span>");
}
}
else
{
if (settings.IsBold)
{
builder.Append("<b>");
builder.Append(range.text);
builder.Append("</b></span>");
}
else
{
builder.Append(range.text);
builder.Append("</span>");
}
}
}
else
{
isEmpty = true;
}
Marshal.ReleaseComObject(element);
}
if (isEmpty)
{
return string.Empty;
}
else
{
return builder.ToString();
}
}