本文整理匯總了C#中TheArtOfDev.HtmlRenderer.Core.Dom.CssBox.OffsetRectangle方法的典型用法代碼示例。如果您正苦於以下問題:C# CssBox.OffsetRectangle方法的具體用法?C# CssBox.OffsetRectangle怎麽用?C# CssBox.OffsetRectangle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TheArtOfDev.HtmlRenderer.Core.Dom.CssBox
的用法示例。
在下文中一共展示了CssBox.OffsetRectangle方法的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(RGraphics g, CssBox b, double baseline)
{
//TODO: Aqui me quede, checar poniendo "by the" con un font-size de 3em
List<CssRect> ws = WordsOf(b);
if (!Rectangles.ContainsKey(b))
return;
RRect r = Rectangles[b];
//Save top of words related to the top of rectangle
double gap = 0f;
if (ws.Count > 0)
{
gap = ws[0].Top - r.Top;
}
else
{
CssRect 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
double 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
double recttop = newtop - gap;
RRect newr = new RRect(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;
}
}