Page 1 of 1

When generating TChart.Metafile and it has black border

Posted: Thu Dec 15, 2005 2:17 pm
by 9638860
Hello All,
When generating TChart metafile and save it. The image has the black border.


((TaoPlotView)this.Controls).tChart.Metafile.Save(stream,ImageFormat.Jpeg);

So Thanks,
Renata

Posted: Thu Dec 15, 2005 3:33 pm
by narcis
Hi Renata,

It works fine for me here using the code below. Can you please test if this works for you? Otherwise, could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.

BTW: Don't forget to mention which TeeChart version you are using.

Code: Select all

tChart1.Export.Image.Metafile.Save(@"c:\temp\metafilebug.emf");

When generating TChart.Metafile and it has black border

Posted: Thu Dec 15, 2005 7:50 pm
by 9638860
Hello Narcís Calvet,

Thanks for your help.
I sent a email for support with the atachment that you asked me.
My TeeChart version is 2.
Thanks,
Renata

When generating TChart.Metafile and it has black border

Posted: Thu Dec 15, 2005 8:51 pm
by 9638860
Hello Narcís Calvet,
The email that I sent you returned.
The steps below will generate the tchart with the black border:

1 - I created the form;
2 - I put a panel in form;
3- I put the TeeChart in panel and dock it;
4 - In form load I put this code:
private void Form1_Load(object sender, System.EventArgs e) {
tChart1.Header.Visible = true;
tChart1.Header.Text = "Test";
Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line();
line.FillSampleValues(10);
tChart1.Series.Add(line);
}
5 - Click button event I saved the TeeChart
private void button1_Click(object sender, System.EventArgs e) {
MemoryStream stream = new MemoryStream();
tChart1.Metafile.Save(stream,ImageFormat.Jpeg);
Image image = Image.FromStream(stream);
image.Save(@"C:\teste1.bmp",ImageFormat.Jpeg);
}

So Thanks,
Renata

Posted: Fri Dec 16, 2005 11:49 am
by narcis
Hi Renata,

I could reproduce what you reported using your code. However, the appropiate way of doing that and what works fine is using:

Code: Select all

		private void button1_Click_1(object sender, System.EventArgs e)
		{
			tChart1.Export.Image.JPEG.Save(@"C:\teste1.jpg");
		}

Print metafile image

Posted: Fri Dec 16, 2005 1:43 pm
by 9638860
Hi Narcís Calvet,
Thanks, but I need metafile image, because the quality is better.
Do you have any idea how I can print metafile image?

So Thanks,
Renata

Posted: Fri Dec 16, 2005 2:24 pm
by narcis
Hi Renata,

Then you can use:

Code: Select all

			tChart1.Export.Image.Metafile.Save(@"C:\temp\teste1.emf");
.

However if you want to print the chart you can do it directly with TeeChart routines as it internally uses a metafile as explained here so you could do:

Code: Select all

		private void button1_Click(object sender, System.EventArgs e)
		{
      tChart1.Printer.Preview();
		}