Page 1 of 1

problem of "SaveToBitmapFile function"

Posted: Fri Mar 23, 2012 7:14 am
by 16560687
My software Teechart version is "Teechart Pro v2011.03.30407".
My application request to save a new chart as BMP file when a new point series or lin series was drawn in chart .But the BMP file saved using function "SaveToBitmapFile" is all the same. I don't know how to solve this problem ,very very urgent ! Who can help me,Thank you. I'd appreciate it.

Re: problem of "SaveToBitmapFile function"

Posted: Fri Mar 23, 2012 12:58 pm
by narcis
Hi sjsun116,
My software Teechart version is "Teechart Pro v2011.03.30407"
Current version is v2011.04 and v2012.05 will be published very soon. You might be interested in testing the latest version.
But the BMP file saved using function "SaveToBitmapFile" is all the same.
What do you exactly mean with this, could you please provide more detailed information? A simple example project we can run "as-is" to reproduce the problem here would also be helpful.

Thanks in advance.

Re: problem of "SaveToBitmapFile function"

Posted: Tue Mar 27, 2012 2:59 pm
by 16560687
Hi Narics,
Thank you.
A question:are these version compatible?

An example(BCB 6.0) such as:
AnsiString ToName;
DateSeparator = '-';
ShortDateFormat = "yyyy/mm/dd";
ToName = DateToStr(Date());
ShortDateFormat = "hh/mm/ss";
ToName = "2D-"+ToName+"-"+DateToStr(Time());
SaveDialog1->FileName = ToName;
if (SaveDialog1->Execute())
{
if (FileExists(SaveDialog1->FileName))
{
DeleteFile(SaveDialog1->FileName);
}
Chart1->SaveToBitmapFile(SaveDialog1->FileName);//chart1 is a Chart Unit
}



This example show how to capture and save the chart picture,when I draw line or point and so on in Chart1.
but I can't get the changed chart picture.

Re: problem of "SaveToBitmapFile function"

Posted: Wed Mar 28, 2012 2:38 pm
by yeray
Hi,

I'm not sure to understand the exact problem either.
I've added a Chart and a TLineSeries with some values at design time, in a new C++Builder application. I've also doped a Button to the form and then used your code just adding a point, and it seems to work fine for me here:

Code: Select all

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Chart1->Series[0]->Add(100);

  AnsiString ToName;
  DateSeparator = '-';
  ShortDateFormat = "yyyy/mm/dd";
  ToName = DateToStr(Date());
  ShortDateFormat = "hh/mm/ss";
  ToName = "2D-"+ToName+"-"+DateToStr(Time())+".bmp";
  SaveDialog1->FileName = ToName;
  if (SaveDialog1->Execute())
  {
    if (FileExists(SaveDialog1->FileName))
    {
      DeleteFile(SaveDialog1->FileName);
    }
    Chart1->SaveToBitmapFile(SaveDialog1->FileName);//chart1 is a Chart Unit
  }
}
If you still have problems with it, please try to arrange a simpl example project we can run as-is to reproduce the problem here.
Thanks in advance.

Re: problem of "SaveToBitmapFile function"

Posted: Tue Apr 03, 2012 4:18 pm
by 16560687
Hi,
I upload a test file developed using C++builder 6.0. Please download three part and then decompress .
The test have three button:draw1,draw2 and ScreenShot.When you click the button "draw1" or the button "draw2",it will draw picture 1 or picture 2.
when you click the button "ScreenShot",it will capture the chart picture.
The problem :
when you click the button "ScreenShot" after "draw1",you will get the picture1.But afterwards you click the button "ScreenShot" after "draw2",you can't
get the picture2.
when you click the button "ScreenShot" after "draw2",you will get the picture2.But afterwards you click the button "ScreenShot" after "draw1",you can't
get the picture1.
How can I get the changed chart picture?


Thanks in advance.
test.part01.rar
test file 01
(488.28 KiB) Downloaded 374 times
test.part02.rar
test file 02
(488.28 KiB) Downloaded 356 times
test.part03.rar
test file 03
(10.61 KiB) Downloaded 342 times

Re: problem of "SaveToBitmapFile function"

Posted: Wed Apr 04, 2012 9:50 am
by yeray
Hi sjsun116,

I could reproduce it with v2011.03 but it seems to work fine in v2011.04 and the current v2012.05.
Could you please give it a try?

Re: problem of "SaveToBitmapFile function"

Posted: Fri Apr 06, 2012 2:08 am
by 16560687
Hi,

OK,Thank you very much.