Page 1 of 1
Any way to "Print" to a metafile, etc?
Posted: Fri Jan 30, 2004 12:06 am
by 8123490
I need to be able to take the chart into a reporting control, but unfortunately the only way to do this is through a bitmap, or a metafile.
Using the TChart.Metafile thing sorta works, but it doesn't seem to have any adjustable settings (Makes sense, since it's the screen representation of the chart).
What I would need is a "Resolution" property like in the Printer attribute. Is that available?
I've also tried the Export.Image.TIFF options, but when it prints, it doesn't look quite right. How would I determine the proper settings between the "Printer" and the "Export" attributes so that they look the same?
Thanks!
Posted: Fri Jan 30, 2004 11:19 am
by Chris
Hi --
need to be able to take the chart into a reporting control, but unfortunately the only way to do this is through a bitmap, or a metafile.
Using the TChart.Metafile thing sorta works, but it doesn't seem to have any adjustable settings (Makes sense, since it's the screen representation of the chart).
What I would need is a "Resolution" property like in the Printer attribute. Is that available?
How about using the .NET Bitmap Class, e.g.
Posted: Fri Jan 30, 2004 1:44 pm
by Pep
Hi,
I've also tried the Export.Image.TIFF options, but when it prints, it doesn't look quite right. How would I determine the proper settings between the "Printer" and the "Export" attributes so that they look the same?
I've tried here and changing de resolucion I've noted that the Title and also the grid lines are not printed. Are you referencing to this ?
Posted: Fri Jan 30, 2004 6:11 pm
by 8123490
The metafile should print out alot cleaner (since it's vector based) as opposed to a bitmap.
The only way that I can sort make the image look the same as the printed version is to mess around with the size of the chart control. Even still, they don't look quite correct.
Essentially, I need a function like:
tChart1.Printer.Resolution = 50;
tChart1.Printer.Export.Metafile.Height = 1024;
tChart1.Printer.Export.Metafile.Width = 768;
Image finalImage = tChart1.Printer.Export.Metafile.SaveImage();
The following samples show how they all output different images (ie. fonts are larger/smaller in relation to the rest of the chart, etc):
//First Image
tChart1.Printer.Resolution = 50;
tChart1.Printer.Landscape = True;
tChart1.Printer.UseAntiAlias = True;
tChart1.Printer.Print();
//Second Image
tChart1.Width = 1024;
tChart1.Height = 768;
Image myImage2 = tChart1.Metafile;
//Third Image
tChart1.Width = 800;
tChart1.Height = 600;
Image myImage3 = tChart1.Metafile;
//Fourth Image
tChart1.Export.Image.TIFF.Width = 1024;
tChart1.Export.Image.TIFF.Height = 768;
tChart1.Export.Image.TIFF.CopyToClipboard();
IDataObject clip = Clipboard.GetDataObject();
Image myImage4 = CType(clip.GetData(GetType(Bitmap)), Image);