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.
tChart is not drawn when I draw the whole Form to bitmap
Re: tChart is not drawn when I draw the whole Form to bitmap
Hello koni,
I suggest do something as next code:
Can you tell us if previous code works as you expected?
I hope will helps.
Thanks,
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);
}
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 |
Instructions - How to post in this forum |
Re: tChart is not drawn when I draw the whole Form to bitmap
It works.
Thank you very much!
Thank you very much!