Page 1 of 1

OnBeforeDrawChart rendered bitmap missing on print

Posted: Fri Jan 28, 2005 9:15 am
by 9083089
Hi,

I have added a background picture to my chart by handling the OnBeforeDrawChart event. In the event handler I use the MFC CImageList::Draw() method to draw a bitmap onto the DC, which I get from CTChart.GetCanvas().GetHandleDC().

This works nicely on the screen and on the Print Preview (CTChart.GetPrinter().ShowPreview()), but on the printed paper, the bitmap image is astoundingly absent. :?

What should I do to make OnBeforeDrawChart()-rendered images appear on the printed paper?

--

Regards

Steffen Skov
senior consultant
Scandpower Petroleum Technology AS

Posted: Tue Feb 01, 2005 10:22 am
by Pep
Hi Steffen,

to see that work please create an .exe file from your VB project and print from there.

Posted: Tue Feb 01, 2005 11:45 am
by 9083089
Pep wrote:to see that work please create an .exe file from your VB project and print from there.
Maybe I posted my original question in the wrong forum.

My project is a Visual C++ project, hence, I am always creating an .exe file, and printing from that...

--

Regards

Steffen Skov
senior consultant
Scandpower Petroleum Technology AS

Posted: Wed Feb 02, 2005 11:34 am
by Pep
Hi Steffen,

I've posted a VC++ example which prints fine using the OnBeforeDrawChart event into the news://steema.net/steema.public.attachments newsgroup, could you please test if it works fine for you ?

Posted: Wed Feb 02, 2005 3:20 pm
by 9083089
Thanks for posting your solution to the news server. I am able to download some of the messages from the server, while others refuse to come my way. As good ol' Murphy would have it, I am of course not able to retrieve the OnBeforeDrawChart example project.
If at all possible, could you please send it to ssk@scandpowerpt.com

Thank you.

--

Regards

Steffen Skov
senior consultant
Scandpower Petroleum Technology AS

Posted: Wed Feb 02, 2005 3:37 pm
by narcis
Hi Steffen,

I've just sent the project to the requested e-mail address.

Posted: Fri Feb 04, 2005 7:23 am
by 9083089
Hi NarcĂ­s,

thank you for your example project.

I made it compile by replacing the GUID of (what I expect is version 7 of) the TeeChart AX with that of version 6 in the resource file. I ran the example, and it worked fine.

However, I did not immediately find that it displays bitmap images in the chart, which is what I had trouble with. In my program I get the windows device context (DC), which the tee chart canvas provides for me, and use that for blitting a bitmap into the chart.

I guess it all comes down to this: Is it possible to use this device context also when printing, or would one have to use the drawing methods on the teechart panel interface? The panel interface does not seem to have any bitmap blitting methods, though, so that would be a tough one for me. :(


--

Kind regards

Steffen Skov
Senior Consultant
Scandpower Petroleum Technology AS

Posted: Fri Feb 11, 2005 1:01 pm
by Pep
Hi Steffen,

one way to do this could be using an Annotation tool (which allows you to set an image), setting its size manually.