void CTChart::Draw(long, long, long, long, long)

TeeChart for ActiveX, COM and ASP
Post Reply
TMECHAM
Newbie
Newbie
Posts: 20
Joined: Tue Aug 17, 2004 4:00 am

void CTChart::Draw(long, long, long, long, long)

Post by TMECHAM » Tue Sep 30, 2008 5:14 pm

I am using the Draw method to render charts on device contexts that have other components and controls being drawn. Having the chart render on my own DCs lets me control the z-order of all of the controls. So I need the Chart to be transparent to anything else rendered on the DC. A major problem is that I can't get CTChart to render transparently. It always clears the rect specifed to the Draw() method. Is there any way to specify a true transparent graph that would just render itself on the DC and not clear then render?

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

Post by Narcís » Mon Oct 06, 2008 11:02 am

Hi TMECHAM,

I'm sorry but as far as I know this is not possible.
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 » Wed Oct 08, 2008 6:28 pm

Yeah, if I understand you correctly, this can be done. Use tchart's OnBeforeDraw event and then write to the DC from there. This will allow you to draw before the chart is drawn, making it look transparent.

To get the DC you want, I used this function:

Code: Select all

CDC& CGraphs::GetDC() const
{
	VARIANT & dcHandle = GetTChart().GetCanvas().GetHandleDC();
	ASSERT(dcHandle.vt == VT_I4);
	CDC& dc = *CDC::FromHandle((HDC)dcHandle.intVal);
	return dc;	
}
Where GetTChart() is just a function to get the tchart object and CGraphs is just a container class.

If you want the actual AX control to be transparent, then that is more difficult. Possibly by setting the AX extended style to WS_TRANSPARENT (I think that is what it is called) and then capturing the WS_PAINT event, you could _potentially_ get it to work, but I've not tried this.

Hope this helps.

Post Reply