Hi,
Thank you for the advice, Narcis.
I do not quite understand the example yet.
So, currently what I am doing is like this:
Code: Select all
private void button1_Click(object sender, System.EventArgs e)
{
this.tChart1.Export.Image.Bitmap.Save("temp.bmp");
//PrintDocument
System.Drawing.Printing.PrintDocument pd =
new System.Drawing.Printing.PrintDocument();
pd.PrintPage +=
new System.Drawing.Printing.PrintPageEventHandler(pd_PrintPage);
//PrintPreviewDialog
PrintPreviewDialog ppd = new PrintPreviewDialog();
ppd.Document = pd;
//show PrintPreviewDialog
ppd.ShowDialog();
}
private void pd_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
//image load
e.Graphics.DrawString("Here comes a text sample.",
new Font("MS UI Gothic",10),new
System.Drawing.SolidBrush(Color.Red),10,10);
// Here comes a TChart image:
Image img = Image.FromFile("temp.bmp");
e.Graphics.DrawImage(img, 100, 100, 600, 600);
img.Dispose();
}
Namely, the TChart area is first converted into a bitmap,
then the bitmap is rendered onto the graphics for the printer
by DrawImage() method at the specified location and size.
In this way, several objects can be laid out onto an A4 paper.
This method works well as long as the printer resolution is not
high compared with the resolution of the temporary TChart
bitmap. Otherwise, the printer result shows poor resolution
of the TChart area.
To avoid this awkward situation, I would like to know the way
to render TCharts directly onto graphics with controling the
location and size.
Could I have any more help?