Hi,
I have two diagrams with diferent set of nodes & links:
- x diagram
- y diagram
Now I want to first show print preview & then print in the way, that y diagram should be available on each page & correspondingly x diagram’s object based on location.
How can I implement it using Goxam?
I implemented this requirement using GoDiagram as:
protected
override void PrintDecoration(Graphics g, PrintPageEventArgs e, int hpnum, int hpmax, int vpnum, int vpmax)
{
String msg = "";
msg =
Program.oGRM.GetStringFromResource("MF_ROUTE") + PSCreateGraph.PSMainFrm.SelectedRteFilter + "\n" +
Program.oGRM.GetStringFromResource("MF_PATTERN") + PSCreateGraph.PSMainFrm.SelectedPtFilter;
Font font = Properties.Settings.Default.Font;
SizeF size = g.MeasureString(msg, font);
PointF pt = new PointF(e.MarginBounds.X, e.MarginBounds.Y + e.MarginBounds.Height);
g.DrawString(msg, font,
Brushes.Blue, pt);
msg = (hpnum + 1).ToString() +
"/" + hpmax.ToString();
size = g.MeasureString(msg, font);
pt =
new PointF(e.MarginBounds.X + e.MarginBounds.Width / 2 - size.Width / 2,
e.MarginBounds.Y + e.MarginBounds.Height);
g.DrawString(msg, font,
Brushes.Blue, pt);
msg = System.Windows.Forms.
SystemInformation.UserName + "\n" + System.DateTime.Today.ToShortDateString();
size = g.MeasureString(msg, font);
pt =
new PointF(e.MarginBounds.X + e.MarginBounds.Width - size.Width,
e.MarginBounds.Y + e.MarginBounds.Height);
g.DrawString(msg, font,
Brushes.Blue, pt);
GraphicsContainer before = g.BeginContainer(); // save Graphics state
GoView _oYAxisView = PSCreateGraph.YAxisView; // get the GoView to be same while printed on each page
RectangleF pYAxisBounds = new RectangleF(_oYAxisView.DocumentTopLeft, _oYAxisView.DocExtentSize);
// draw into left margin, but not into top-left corner of page
// NB: the palette's Width needs to fit into the margin, otherwise it will overlap with the main view
g.TranslateTransform(
Math.Max(0, e.MarginBounds.X - pYAxisBounds.Width), e.MarginBounds.Y);
g.ScaleTransform(PrintScale, PrintScale);
// draw at same scale as the rest of the view
g.TranslateTransform(pYAxisBounds.X, pYAxisBounds.Y);
// normalize palette's PrintDocumentTopLeft
foreach (GoLayer oLayer in _oYAxisView.Layers) // draw each palette's document's layer
{
if (oLayer.Identifier.ToString() == "YAxisLabelLayer")
{
oLayer.Paint(g, _oYAxisView, pYAxisBounds);
Pen objPen = new Pen(Color.Black, 1.0F);
g.DrawLine(objPen,
new PointF(pYAxisBounds.Width, pYAxisBounds.Top), new PointF(pYAxisBounds.Width, pYAxisBounds.Top + pYAxisBounds.Height));
break;
}
}
g.EndContainer(before);
// restore Graphics state, so that this view will print normally
}