ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Transparent background on real-time chart
Posted by Cody Knight on Jan-25-2017 05:17
Hello,

Using C++, I have created a semicircle AngularMeter that runs/updates frequently to animate the needle moving around the meter face. The meters are inside borderless dialogs with transparent backgrounds. The issue is when the dialog boundaries of two meters overlap (the empty space in the rectangle that the meter doesn't occupy), there is a large amount of flickering as each paints over the other in the animation loop. I have tried setting the background area of the chart to Chart::Transparent, but this only creates a white background.

I would like to know if there is a way to make the background of the chart truly transparent like the dialog to avoid this flickering and just display the chart underneath within the "background" area that doesn't contain the meter.

Any assistance is appreciated.

Thanks,
Cody

  Re: Transparent background on real-time chart
Posted by Peter Kwan on Jan-25-2017 22:53
Attachments:
Hi Cody,

Since ChartDirector 6.0, a transparent chart will really be rendered as transparent. I have attached a screen shot with a chart on a transparent dialog (with a non-transparent title bar so you can see the dialog easily) for your reference.

However, I am not sure if this can solve your current issue as it is related to how your dialog paint the controls to the screen. For example, if two meters overlap, and the bottom meter is updated, the system cannot just repaint the bottom meter to the screen, otherwise the bottom meter will cover up the top meter. It would have to wipe away the part of the screen within the boundary box of the bottom meter, repaint the screen background, repaint the bottom meter, then repaint top meter.

It is possible to do the above without flickering (eg. by double buffering of the part of the screen that needs to be updated). However, I suspect MFC itself is not designed to handle transparency and would not use double buffering or other techniques to avoid flickering.  (Note that double buffering of the MFC control would not solve the problem. We need to double buffer the dialog itself.) Another issue is that MFC may not even bother the repaint all the layers under the meter from the bottom up, as there is no need to repaint these layers if the meter is not transsparent.

Regards
Peter Kwan
transparent_chart.png