Added Property yVeryBottom

Changed the format of the Verical Ruler in the Debug PDF Layer to start at the top margin and extend to the bottom margin.
Partial fix of the logic to display an XY Plot.
This commit is contained in:
Rich 2013-07-01 17:41:04 +00:00
parent 78add0ccd2
commit 7bc0e8846e
3 changed files with 62 additions and 34 deletions

View File

@ -182,13 +182,15 @@ namespace Volian.Print.Library
private void DrawRuler(PdfContentByte cb) private void DrawRuler(PdfContentByte cb)
{ {
if (DebugLayer == null) return; if (DebugLayer == null) return;
Layout layout = MySection.MyDocStyle.Layout;
cb.SaveState(); cb.SaveState();
cb.BeginLayer(DebugLayer); cb.BeginLayer(DebugLayer);
float x = (cb.PdfWriter.PageSize.Left + cb.PdfWriter.PageSize.Right) / 2; float x = (cb.PdfWriter.PageSize.Left + cb.PdfWriter.PageSize.Right) / 2;
cb.SetLineWidth(.1F); cb.SetLineWidth(.1F);
cb.SetColorStroke(new Color(System.Drawing.Color.CornflowerBlue)); cb.SetColorStroke(new Color(System.Drawing.Color.CornflowerBlue));
float yTop = 648; float yTop = (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin);
float yBottom = 48; float yBottom = (float)(cb.PdfWriter.PageSize.Height - (layout.TopMargin + layout.PageLength));
Console.WriteLine("'{0}',{1},{2}", MySection.MyDocStyle.Name, yTop, yBottom);
cb.MoveTo(x, yTop); cb.MoveTo(x, yTop);
cb.LineTo(x, yBottom); cb.LineTo(x, yBottom);
int i = 0; int i = 0;
@ -197,9 +199,11 @@ namespace Volian.Print.Library
float w = 10; float w = 10;
if (i % 10 == 0) w = 30; if (i % 10 == 0) w = 30;
else if (i % 5 == 0) w = 20; else if (i % 5 == 0) w = 20;
cb.SetLineWidth(w / 30);
i++; i++;
cb.MoveTo(x - w, y); cb.MoveTo(x - w, y);
cb.LineTo(x, y); cb.LineTo(x, y);
cb.Stroke();
} }
i = 0; i = 0;
for (float y = yTop; y >= yBottom; y -= 10.1F) for (float y = yTop; y >= yBottom; y -= 10.1F)
@ -207,11 +211,13 @@ namespace Volian.Print.Library
float w = 10; float w = 10;
if (i % 10 == 0) w = 30; if (i % 10 == 0) w = 30;
else if (i % 5 == 0) w = 20; else if (i % 5 == 0) w = 20;
cb.SetLineWidth(w / 30);
i++; i++;
cb.MoveTo(x + w, y-1); cb.MoveTo(x + w, y-1);
cb.LineTo(x, y-1); cb.LineTo(x, y-1);
cb.Stroke();
} }
Layout layout = MySection.MyDocStyle.Layout; cb.SetLineWidth(.1F);
cb.Rectangle((float)layout.LeftMargin, (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin), (float)layout.PageWidth - (float)layout.LeftMargin, (float)-layout.PageLength); cb.Rectangle((float)layout.LeftMargin, (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin), (float)layout.PageWidth - (float)layout.LeftMargin, (float)-layout.PageLength);
float yRuler = 612; float yRuler = 612;
cb.MoveTo(0, yRuler); cb.MoveTo(0, yRuler);

View File

@ -905,6 +905,26 @@ namespace Volian.Print.Library
return bottom; return bottom;
} }
} }
public float YVeryBottom
{
get
{
float bottom = YOffset + Height;
if (ChildrenBelow != null)
foreach (vlnParagraph child in ChildrenBelow)
bottom = Math.Max(child.YVeryBottom, bottom);
if (ChildrenLeft != null)
foreach (vlnParagraph child in ChildrenLeft)
bottom = Math.Max(child.YVeryBottom, bottom);
if (ChildrenRight != null)
foreach (vlnParagraph child in ChildrenRight)
bottom = Math.Max(child.YVeryBottom, bottom);
if (PartsBelow != null)
foreach (vlnPrintObject part in PartsBelow)
bottom = Math.Max(part.YBottom, bottom);
return bottom;
}
}
public float YBottomText public float YBottomText
{ {
get get

View File

@ -21,6 +21,8 @@ namespace XYPlots
public frmXYPlot(string title,string xyPlot) public frmXYPlot(string title,string xyPlot)
{ {
InitializeComponent(); InitializeComponent();
int pstart = xyPlot.IndexOf("<<G"); // find the starting Plot Command
xyPlot = xyPlot.Substring(pstart); // set val to the start of the plot commands
_XYPlot =xyPlot; _XYPlot =xyPlot;
_Title = title; _Title = title;
} }