tChart is not drawn when I draw the whole Form to bitmap

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Koni
Newbie
Newbie
Posts: 3
Joined: Fri May 13, 2011 12:00 am

tChart is not drawn when I draw the whole Form to bitmap

Post by Koni » Wed Oct 12, 2011 1:29 pm

I want to draw a whole System.Windows.Form to Bitmap (make a screenshot of the form). Everything works fine, and all controls are drawn to the bitmap. The only exception is that the tChart contained in the Form does not appear in the bitmap. I ise the following code:

private void button1_Click(object sender, EventArgs e)
{
Bitmap m_oScreenshot = new Bitmap(Width, Height);
Rectangle r = new Rectangle(0, 0, Width, Height);
this.DrawToBitmap(m_oScreenshot, r);
m_oScreenshot.Save("D:\\temp\\Test.bmp");
}

this means the form itself.

What can I do that the Chart is drawn to the bitmap? Thanks in advance.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: tChart is not drawn when I draw the whole Form to bitmap

Post by Sandra » Thu Oct 13, 2011 1:14 pm

Hello koni,


I suggest do something as next code:

Code: Select all

  private void button1_Click(object sender, EventArgs e)
        {
            Bitmap m_oScreenshot = new Bitmap(Width, Height);
            Graphics gfx = Graphics.FromImage((Image)m_oScreenshot);
            gfx.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(Width, Height));
            m_oScreenshot.Save("C:\\temp\\test.bmp", ImageFormat.Bmp);   
        }
Can you tell us if previous code works as you expected?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Koni
Newbie
Newbie
Posts: 3
Joined: Fri May 13, 2011 12:00 am

Re: tChart is not drawn when I draw the whole Form to bitmap

Post by Koni » Fri Oct 14, 2011 8:50 am

It works.
Thank you very much!

Post Reply