public override RectangleF TextRectForBounds(RectangleF bounds, int numberOfLines)
{
RectangleF calculatedRect = base.TextRectForBounds(bounds, numberOfLines);
if (_VerticalAlignment != UIVerticalAlignment.Top)
{
if (_VerticalAlignment == UIVerticalAlignment.Bottom)
{
bounds.Y += bounds.Height - calculatedRect.Height; //move down by difference
}
else
{
bounds.Y += (bounds.Height - calculatedRect.Height) / 2;
}
}
bounds.Height = calculatedRect.Height; //always the calculated height
return (bounds);
}
}