How do I make use the PrintDecoration?


#1

Hi
How do I make use the PrintDecoration to add Header and footer?
Do you have any example that you could show me.
Thanks
Best
Min


Add Header footer on printed document
Printing
#2

There’s an example override of GoView.PrintDecoration in the GraphView class in the Demo1 sample application. This displays the X,Y printed page number as a footer.


#3

I don’t know why I could not find override PrintDecoration in GraphView class in the Demo1.
Do you mind post the code snippet here?
Thanks


#4

I just downloaded and installed the GoDiagram Express and GoDiagram Win kits, and they both had an override of PrintDecoration in GraphView.cs of the Demo1 sample. Well, anyway, here’s the code:
protected override void PrintDecoration(Graphics g, PrintPageEventArgs e, int hpnum, int hpmax, int vpnum, int vpmax) {
String msg = hpnum.ToString() + “,” + vpnum.ToString();
Font font = new Font(“Verdana”, 10);
SizeF size = g.MeasureString(msg, font);
PointF 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);
base.PrintDecoration (g, e, hpnum, hpmax, vpnum, vpmax);
}