mirror of
https://github.com/ckaczor/Common.Wpf.git
synced 2026-01-14 10:00:05 -05:00
Initial commit
This commit is contained in:
49
HtmlLabelControl/TextLine.cs
Normal file
49
HtmlLabelControl/TextLine.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Common.Wpf.HtmlLabelControl
|
||||
{
|
||||
public class TextLine
|
||||
{
|
||||
private double _height;
|
||||
public double Height
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_height == 0)
|
||||
{
|
||||
foreach (TextFragment textFragment in FragmentList)
|
||||
{
|
||||
if (textFragment.FormattedText.Height > _height)
|
||||
_height = textFragment.FormattedText.Height;
|
||||
}
|
||||
}
|
||||
|
||||
return _height;
|
||||
}
|
||||
}
|
||||
|
||||
private double _width;
|
||||
public double Width
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_width == 0)
|
||||
{
|
||||
foreach (TextFragment textFragment in FragmentList)
|
||||
{
|
||||
_width += textFragment.FormattedText.Width;
|
||||
}
|
||||
}
|
||||
|
||||
return _width;
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<TextFragment> FragmentList { get; private set; }
|
||||
|
||||
public TextLine()
|
||||
{
|
||||
FragmentList = new Collection<TextFragment>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user