Page 1 of 1

OnAfterDrawChart not working as expected

Posted: Thu Jun 29, 2006 2:27 pm
by 9525016
I've just tried to use OnAfterDrawChart() and it acts strangely. I can see the test object show up but it is immediatly replaced by the stuff I just covered up, as if an invalidate has occured but without causing the OnAfterDrawChart() to be reinvoked. Why would this be? Here is the code fragment:

Code: Select all

void CTest::OnAfterDrawChart()
{
   CTChart & tchart = GetTChart();
   CRect rect(0, 0, 300, 300);
   CDC& dc = *tchart.GetDC();
   dc.SelectStockObject(NULL_BRUSH);
   dc.Rectangle(rect);
   tchart.ReleaseDC(&dc);
} 
Thanks,


Adrian

Posted: Thu Jun 29, 2006 2:32 pm
by narcis
Hi Adrian,

When initializing the chart you'll have to call m_Chart1.GetEnvironment().InternalRepaint(); so that OnAfterDraw event is fired.

Posted: Thu Jun 29, 2006 2:37 pm
by 9525016
Hi NarcĂ­s,

The event was already being fired, and after I used the InternalRepaint() call it didn't make a difference. I can see the test object showing up, but it gets painted over.

Any ideas?

Thanks,


Adrian

Posted: Wed Jul 05, 2006 2:57 pm
by Pep
Hi Adrian,

I'm not sure what are you trying to accomplish, would you be so kind to explain me and I'll try to replicate it here and try to find a solution (if exists) ?

Posted: Wed Jul 05, 2006 3:13 pm
by 9525016
It is OK. I found a way to get the canvas DC on which I can draw directly on.

Thanks,


Adrian