From 5271561b84a617628c463dba7e1568376146e6af Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 24 Oct 2013 21:47:01 +0000 Subject: [PATCH] Erase the existing background (including any lines) before drawing a box. This allows boxes to be placed over curves and lines. Change the order of lines being drawn to support boxes being able to be placed on top of curves and lines. --- PROMS/VG/IVGOutput.cs | 7 ++++++- PROMS/XYPlots/XYPlots.cs | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/PROMS/VG/IVGOutput.cs b/PROMS/VG/IVGOutput.cs index 74bde40c..ef2bd465 100644 --- a/PROMS/VG/IVGOutput.cs +++ b/PROMS/VG/IVGOutput.cs @@ -34,7 +34,12 @@ namespace VG public void DrawLine(Pen pn, float startx, float starty, float endx, float endy) { _VGOutput.DrawLine(pn, startx, starty, endx, endy); } public void DrawRectangle(Pen pn, RectangleF rectf) - { _VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height); } + { + _VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy; + _VGOutput.FillRectangle(Brushes.Transparent, rectf.X, rectf.Y, rectf.Width, rectf.Height); + _VGOutput.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver; + _VGOutput.DrawRectangle(pn, rectf.X, rectf.Y, rectf.Width, rectf.Height); + } public void DrawEllipse(Pen pn, float cx, float cy, float dx, float dy) { _VGOutput.DrawEllipse(pn, cx, cy, dx, dy); } public void DrawImage(Bitmap bm, RectangleF rectf) diff --git a/PROMS/XYPlots/XYPlots.cs b/PROMS/XYPlots/XYPlots.cs index f0e3696d..09e336a5 100644 --- a/PROMS/XYPlots/XYPlots.cs +++ b/PROMS/XYPlots/XYPlots.cs @@ -721,6 +721,8 @@ namespace XYPlots Position[X] = 0; Position[Y] = 0; // printerunits[Y]; SavePosition(); + SetPenDiameter(5); + BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput); if (GridOnFlag == 0) Visible = 0; //if (vgOutput is VGOut_Graphics) //{ @@ -741,8 +743,8 @@ namespace XYPlots Visible = 1; RecallPosition(); // Draw outline last to overlap any grid lines. - SetPenDiameter(5); - BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput); + //SetPenDiameter(5); + //BoxRelative(printerunits[X], printerunits[Y], CurPenWidth, pg, vgOutput); } private void DoGrid(int flag, VG.Page pg, IVGOutput vgOutput) { @@ -1940,8 +1942,8 @@ namespace XYPlots VG.Page pg = new Page(true, _LeftMargin, _TopMargin, _RightMargin, _BottomMargin); GenerateGrid(pg, vgOutput); DoAxisTitles(pg, vgOutput); - DoBoxes(pg, vgOutput); DrawLines(pg, vgOutput); + DoBoxes(pg, vgOutput); FreeBoxList(); FreeLineList(); CloseGraph();