Any way to "Print" to a metafile, etc?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

Any way to "Print" to a metafile, etc?

Post by swong » Fri Jan 30, 2004 12:06 am

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!

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Fri Jan 30, 2004 11:19 am

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.

Code: Select all

Bitmap b = tChart1.Bitmap;
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jan 30, 2004 1:44 pm

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 ?

swong
Newbie
Newbie
Posts: 24
Joined: Thu Jan 15, 2004 5:00 am

Post by swong » Fri Jan 30, 2004 6:11 pm

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);

Post Reply