OnAfterDrawChart not working as expected

TeeChart for ActiveX, COM and ASP
Post Reply
Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

OnAfterDrawChart not working as expected

Post by Vivo » Thu Jun 29, 2006 2:27 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jun 29, 2006 2:32 pm

Hi Adrian,

When initializing the chart you'll have to call m_Chart1.GetEnvironment().InternalRepaint(); so that OnAfterDraw event is fired.
Best Regards,
Narcís Calvet / 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

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Thu Jun 29, 2006 2:37 pm

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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jul 05, 2006 2:57 pm

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) ?

Vivo
Newbie
Newbie
Posts: 36
Joined: Fri Nov 26, 2004 5:00 am
Contact:

Post by Vivo » Wed Jul 05, 2006 3:13 pm

It is OK. I found a way to get the canvas DC on which I can draw directly on.

Thanks,


Adrian

Post Reply