Hi,
I am printing 2 tcharts on one page. Now i want to add title to the page, so when it print out, it will have the title and the charts. How can i do it?
Thanks.
Regards,
Nicholas
Printer - Print title on page of 2 tcharts
-
- Newbie
- Posts: 8
- Joined: Wed Nov 04, 2009 12:00 am
Re: Printer - Print title on page of 2 tcharts
Hi Nicholas,
Here is how you could do it:
Here is how you could do it:
Code: Select all
private void InitializeChart()
{
int MyWidth = 400;
int MyHeight = 300;
tChart1 = new Steema.TeeChart.TChart();
this.Controls.Add(tChart1);
tChart1.Top = 100;
tChart1.Width = MyWidth;
tChart1.Height = MyHeight;
new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1[0].FillSampleValues();
tChart2 = new Steema.TeeChart.TChart();
this.Controls.Add(tChart2);
tChart2.Left = MyWidth;
tChart2.Top = 100;
tChart2.Width = MyWidth;
tChart2.Height = MyHeight;
new Steema.TeeChart.Styles.Line(tChart2.Chart);
tChart2[0].FillSampleValues();
System.Drawing.Printing.PrintDocument document = new System.Drawing.Printing.PrintDocument();
document.PrintController = new System.Drawing.Printing.StandardPrintController();
document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(document_PrintPage);
tChart1.Draw();
tChart2.Draw();
document.Print();
}
void document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Rectangle r1 = new Rectangle(0, 0, tChart1.Chart.Width, tChart1.Chart.Height);
Rectangle r2 = new Rectangle(0, tChart1.Chart.Height, tChart2.Chart.Width, tChart2.Chart.Height);
System.Drawing.Imaging.Metafile m = tChart1.Chart.Metafile(tChart1.Chart, r1.Width, r1.Height);
System.Drawing.Imaging.Metafile m2 = tChart1.Chart.Metafile(tChart2.Chart, r2.Width, r2.Height);
e.Graphics.DrawImage(m, r1, tChart1.Chart.ChartBounds, GraphicsUnit.Pixel);
e.Graphics.DrawImage(m2, r2, tChart2.Chart.ChartBounds, GraphicsUnit.Pixel);
Font myFont = new Font("Arial", 15, FontStyle.Bold);
e.Graphics.DrawString("My charts", myFont, Brushes.Black, 20, tChart1.Chart.Height + tChart2.Chart.Height + 10);
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 8
- Joined: Wed Nov 04, 2009 12:00 am
Re: Printer - Print title on page of 2 tcharts
Hi Yeray,
Thank you. How about print preview? From print preview, there is a print button. Once i click on print button, it will print without my topic. How can i do that?
Regards,
Nicholas
Thank you. How about print preview? From print preview, there is a print button. Once i click on print button, it will print without my topic. How can i do that?
Regards,
Nicholas
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Printer - Print title on page of 2 tcharts
Hi Nicholas,
You could try something like this.
I also strongly recommend you to read Tutorial14 - Printing Charts, specially the Print previewing several Charts on one page and Mixing printed Chart output with other print output sections. You'll find the tutorials at TeeChart's program group.
Hope this helps!
You could try something like this.
I also strongly recommend you to read Tutorial14 - Printing Charts, specially the Print previewing several Charts on one page and Mixing printed Chart output with other print output sections. You'll find the tutorials at TeeChart's program group.
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |