48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
///
|
|
/// Copyright (c) 2023 Sensus Slovensko a.s.
|
|
///
|
|
using Common;
|
|
using System.Drawing;
|
|
using System.Drawing.Printing;
|
|
|
|
namespace Results.Output
|
|
{
|
|
public class Cell
|
|
{
|
|
public readonly string Text;
|
|
public readonly Font Font;
|
|
public readonly Alignment HorizAlignment;
|
|
public readonly VertAlignment VertAlignment;
|
|
public readonly bool TopBorder;
|
|
public readonly bool LeftBorder;
|
|
public readonly bool BottomMerge;
|
|
public readonly bool RightMerge;
|
|
|
|
public SizeF Size { get { return size; } }
|
|
SizeF size;
|
|
|
|
public Cell() { }
|
|
|
|
public Cell(string text, Font font, Alignment horizAlignment = Alignment.Left,
|
|
VertAlignment vertAlignment = VertAlignment.Top, bool topBorder = false,
|
|
bool leftBorder = false, bool bottomMerge = false, bool rightMerge = false)
|
|
{
|
|
Text = text;
|
|
Font = font;
|
|
HorizAlignment = horizAlignment;
|
|
VertAlignment = vertAlignment;
|
|
TopBorder = topBorder;
|
|
LeftBorder = leftBorder;
|
|
BottomMerge = bottomMerge;
|
|
RightMerge = rightMerge;
|
|
}
|
|
|
|
public void Measure(PrintPageEventArgs e)
|
|
{
|
|
size = (Text != null && Font != null)
|
|
? Common.Printers.PrintersCommon.Measure(e, Text, Font)
|
|
: new SizeF(0, 0);
|
|
}
|
|
}
|
|
}
|