本文整理汇总了C#中HtmlRenderer.Dom.CssBox.FirstWordOccourence方法的典型用法代码示例。如果您正苦于以下问题:C# CssBox.FirstWordOccourence方法的具体用法?C# CssBox.FirstWordOccourence怎么用?C# CssBox.FirstWordOccourence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlRenderer.Dom.CssBox
的用法示例。
在下文中一共展示了CssBox.FirstWordOccourence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetBaseLine
/// <summary>
/// Sets the baseline of the words of the specified box to certain height
/// </summary>
/// <param name="g">Device info</param>
/// <param name="b">box to check words</param>
/// <param name="baseline">baseline</param>
internal void SetBaseLine(Graphics g,CssBox b, float baseline)
{
//TODO: Aqui me quede, checar poniendo "by the" con un font-size de 3em
List<CssBoxWord> ws = WordsOf(b);
if (!Rectangles.ContainsKey(b)) return;
RectangleF r = Rectangles[b];
//Save top of words related to the top of rectangle
float gap = 0f;
if (ws.Count > 0)
{
gap = ws[0].Top - r.Top;
}
else
{
CssBoxWord firstw = b.FirstWordOccourence(b, this);
if (firstw != null)
{
gap = firstw.Top - r.Top;
}
}
//New top that words will have
//float newtop = baseline - (Height - OwnerBox.FontDescent - 3); //OLD
float newtop = baseline;// -GetBaseLineHeight(b, g); //OLD
if (b.ParentBox != null &&
b.ParentBox.Rectangles.ContainsKey(this) &&
r.Height < b.ParentBox.Rectangles[this].Height)
{
//Do this only if rectangle is shorter than parent's
float recttop = newtop - gap;
RectangleF newr = new RectangleF(r.X, recttop, r.Width, r.Height);
Rectangles[b] = newr;
b.OffsetRectangle(this, gap);
}
foreach (var word in ws)
{
if (!word.IsImage)
word.Top = newtop;
}
}