void CTChart::Draw(long, long, long, long, long)
void CTChart::Draw(long, long, long, long, long)
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?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi TMECHAM,
I'm sorry but as far as I know this is not possible.
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 |
Instructions - How to post in this forum |
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:
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.
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;
}
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.