Zapiska: (1) GapBetweenTableColumns (20 -> 10), (2) multiline item support.
This commit is contained in:
parent
a5bb127a1e
commit
c3eab4820f
@ -14,7 +14,8 @@ namespace Results.Output.Printers.Zapiska
|
||||
{
|
||||
public class ZapiskaPrintDocument : PrintDocument
|
||||
{
|
||||
const int GapBetweenCommonColumns = 10;
|
||||
const int GapBetweenTableColumns = 10;
|
||||
const int GapBetweenCommonColumns = 10;
|
||||
|
||||
/// Size of the printed area without margins, after taking into account 'pageOrientation'
|
||||
readonly int printHeight;
|
||||
@ -229,11 +230,15 @@ namespace Results.Output.Printers.Zapiska
|
||||
|
||||
/// Determine left column width
|
||||
int leftColWidth = 0;
|
||||
foreach (var s in leftColumn)
|
||||
{
|
||||
int itemWidth = (int)e.Graphics.MeasureString(s, font).Width;
|
||||
if (itemWidth > leftColWidth) leftColWidth = itemWidth;
|
||||
}
|
||||
foreach (var paragraph in leftColumn)
|
||||
{
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
int itemWidth = (int)e.Graphics.MeasureString(paragraph, font).Width;
|
||||
if (itemWidth > leftColWidth) leftColWidth = itemWidth;
|
||||
}
|
||||
}
|
||||
|
||||
/// Write aligned columns
|
||||
for (int i = 0; i < Math.Min(leftColumn.Length, rightColumn.Length); i++)
|
||||
@ -289,10 +294,14 @@ namespace Results.Output.Printers.Zapiska
|
||||
|
||||
/// Determine left column width
|
||||
int leftColWidth = 0;
|
||||
foreach (var s in leftColumn)
|
||||
foreach (var paragraph in leftColumn)
|
||||
{
|
||||
int itemWidth = (int)e.Graphics.MeasureString(s, font).Width;
|
||||
if (itemWidth > leftColWidth) leftColWidth = itemWidth;
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
int itemWidth = (int)e.Graphics.MeasureString(paragraph, font).Width;
|
||||
if (itemWidth > leftColWidth) leftColWidth = itemWidth;
|
||||
}
|
||||
}
|
||||
|
||||
/// Write aligned columns
|
||||
@ -345,10 +354,10 @@ namespace Results.Output.Printers.Zapiska
|
||||
float width = e.Graphics.MeasureString(itemText, font).Width;
|
||||
if (width > columnWidth) columnWidth = width;
|
||||
}
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + 20.0f;
|
||||
columnPos[i + 1] = columnPos[i] + columnWidth + (float)GapBetweenTableColumns;
|
||||
}
|
||||
int tableLeftX = (int)columnPos[0];
|
||||
int tableRightX = (int)columnPos[selectedItems.Count] - 20;
|
||||
int tableRightX = (int)columnPos[selectedItems.Count] - GapBetweenTableColumns;
|
||||
|
||||
/// Horizontal line
|
||||
int horY = top + SpacingOneAndHalf4Header;
|
||||
@ -395,29 +404,37 @@ namespace Results.Output.Printers.Zapiska
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string paragraph)
|
||||
{
|
||||
PrintAt(e, p.X, p.Y, text);
|
||||
PrintAt(e, p.X, p.Y, paragraph);
|
||||
}
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string paragraph)
|
||||
{
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
|
||||
e.Graphics.DrawString(line, this.font, Brushes.Black, printArea);
|
||||
y += 8 * SpacingOne / 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrintAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string paragraph)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne);
|
||||
e.Graphics.DrawString(text, this.font, Brushes.Black, printArea);
|
||||
PrintHeaderAt(e, p.X, p.Y, paragraph);
|
||||
}
|
||||
|
||||
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, Point p, string text)
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string paragraph)
|
||||
{
|
||||
PrintHeaderAt(e, p.X, p.Y, text);
|
||||
}
|
||||
|
||||
|
||||
void PrintHeaderAt(System.Drawing.Printing.PrintPageEventArgs e, int x, int y, string text)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
|
||||
e.Graphics.DrawString(text, this.headerFont, Brushes.Black, printArea);
|
||||
}
|
||||
string[] lines = paragraph.Split(new char[] { '~' });
|
||||
foreach (var line in lines)
|
||||
{
|
||||
RectangleF printArea = new RectangleF(x, y, 2000, SpacingOne4Header);
|
||||
e.Graphics.DrawString(paragraph, this.headerFont, Brushes.Black, printArea);
|
||||
y += 8 * SpacingOne4Header / 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.17.675.1")]
|
||||
[assembly: AssemblyFileVersion("2.17.675.1")]
|
||||
[assembly: AssemblyVersion("2.17.676.1")]
|
||||
[assembly: AssemblyFileVersion("2.17.676.1")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user