When generating TChart.Metafile and it has black border

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Igor Maystruk
Newbie
Newbie
Posts: 7
Joined: Wed Oct 19, 2005 4:00 am

When generating TChart.Metafile and it has black border

Post by Igor Maystruk » Thu Dec 15, 2005 2:17 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Dec 15, 2005 3:33 pm

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");
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Igor Maystruk
Newbie
Newbie
Posts: 7
Joined: Wed Oct 19, 2005 4:00 am

When generating TChart.Metafile and it has black border

Post by Igor Maystruk » Thu Dec 15, 2005 7:50 pm

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

Igor Maystruk
Newbie
Newbie
Posts: 7
Joined: Wed Oct 19, 2005 4:00 am

When generating TChart.Metafile and it has black border

Post by Igor Maystruk » Thu Dec 15, 2005 8:51 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Dec 16, 2005 11:49 am

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");
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Igor Maystruk
Newbie
Newbie
Posts: 7
Joined: Wed Oct 19, 2005 4:00 am

Print metafile image

Post by Igor Maystruk » Fri Dec 16, 2005 1:43 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Dec 16, 2005 2:24 pm

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();
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply