Page 1 of 1

Canvas drawings not shown in BMP image

Posted: Thu May 18, 2006 7:31 pm
by 9079842
I'm drawing some arrows on top of my series using teechart canvas. Then I export the teechart as JPEG or BMP. But the arrows do not appear in the images. What should be done to get the image with the canvas drawings in it?

Function I used for drawing arrow:
m_tChart.GetCanvas().Arrow(TRUE, x, y+20, x, y, 5, 5, 0);

Function I used for creating BMP file:
m_tChart.GetExport().GetAsBMP().SaveToFile((LPCTSTR)fileName);

Some of the posts in the forum suggest putting canvas drawings into OnAfterDraw method. But in my version of teechart, I could not find OnAfterDraw method in any of the .h files.

Posted: Fri May 19, 2006 7:53 am
by narcis
Hi psahay,

Please have a look at the examples at C:\Program Files\Steema Software\TeeChart Pro v6 ActiveX Control\Examples\Visual C++\Version 6 (default english installation path). Some of them use TeeChart's OnAfterDraw event.

Posted: Fri May 19, 2006 6:57 pm
by 9079842
Hi Narcis,

I added the OnAfterDraw method like this, but this method never gets invoked.

in .h file:
protected:
DECLARE_EVENTSINK_MAP()

in .cpp file:
BEGIN_EVENTSINK_MAP(CClockDataBaseWindow, CWnd)
//{{AFX_EVENTSINK_MAP(CClockDataBaseWindow)
ON_EVENT(CClockDataBaseWindow, IDC_TCHART1, 1 /* OnAfterDraw */, OnOnAfterDrawTchart1, VTS_NONE)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()

void CClockDataBaseWindow::OnOnAfterDrawTchart1()
{
// canvas drawing code
}

Posted: Mon May 22, 2006 8:45 am
by narcis
Hi psahay,

Have you looked at the examples I pointed you in my previous post?

Posted: Thu May 25, 2006 7:04 pm
by 9079842
Hi Narcis,

The OnAfterDraw method worked for me. I was using a wrong window id in my code which I discovered later.

Thanks for the help.

Regards,
Pratyush.