This commit is contained in:
Kathy Ruffing 2011-06-16 10:38:24 +00:00
parent 82900d18f0
commit c37687639d

View File

@ -37,6 +37,7 @@ namespace Volian.Print.Library
} }
public const string BoxThin = "\x2510.\x2500.\x250c.\x2502. . .\x2518.\x2514. .\x2500. . "; public const string BoxThin = "\x2510.\x2500.\x250c.\x2502. . .\x2518.\x2514. .\x2500. . ";
const string BoxThick = "\x2584.\x2584.\x2584.\x2588. . .\x2580.\x2580. .\x2580. . "; const string BoxThick = "\x2584.\x2584.\x2584.\x2588. . .\x2580.\x2580. .\x2580. . ";
const string BoxDouble = "\x2557.\x2550.\x2554.\x2551. . .\x255D.\x255A. .\x2550. . ";
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{ {
cb.SaveState(); cb.SaveState();
@ -58,24 +59,34 @@ namespace Volian.Print.Library
} }
else else
{ {
const float llxOffset = 3;
float lineThickness = 0; float lineThickness = 0;
switch (MyBox.BoxStyle) switch (MyBox.BoxStyle)
{ {
case BoxThin: case BoxThin:
lineThickness = .6F; lineThickness = .6F;
cb.SetLineWidth(lineThickness);
cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier);
break; break;
case BoxThick: case BoxThick:
lineThickness = 6; lineThickness = 6;
cb.SetLineWidth(lineThickness);
cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier);
break;
case BoxDouble:
lineThickness = .6F;
cb.SetLineWidth(lineThickness);
// outer rectangle (rectangle's are defined as x,y,w,h)
cb.Rectangle(left + llxOffset - lineThickness * 1.5F, bottom - lineThickness, right - left + lineThickness * 3, (Height + lineThickness * 2) * MyPageHelper.YMultiplier);
// inner rectangle
cb.Rectangle(left + llxOffset + lineThickness, bottom + lineThickness * 1.5F, right - left - lineThickness * 2, (Height - lineThickness * 3) * MyPageHelper.YMultiplier);
break; break;
default: default:
// For other than OHLP/HLP. For those not matching the HLP Boxes // For other than thick, thin and double.
Console.WriteLine("NO BOXES"); Console.WriteLine("NO BOXES");
break; break;
//throw new Exception("Missing vlnBox handler"); //throw new Exception("Missing vlnBox handler");
} }
const float llxOffset = 3;
cb.SetLineWidth(lineThickness);
cb.Rectangle(left + llxOffset, bottom + (lineThickness / 2), right - left, (Height - lineThickness) * MyPageHelper.YMultiplier);
} }
cb.Stroke(); cb.Stroke();
if (textLayer != null) cb.EndLayer(); if (textLayer != null) cb.EndLayer();