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

Message ListMessage List     Post MessagePost Message

  Transparent background
Posted by Patrice on Apr-11-2007 01:29
I have an XYchart in my windows form. A backgound image is set for my form. I want to see my image behind the chart by setting the backgound color of my chart to transparent. I tried some example but I always ends up with a black background instead of transparent for my chart...

Is there a way to acheive that?

  Re: Transparent background
Posted by Peter Kwan on Apr-11-2007 05:13
Hi Patrice,

The Chart.Transparent cannot be used to output a transparent chart with respect to a Windows Form background, because .NET controls do not support alpha transparency at all. The .NET framework only supports single color transparency for a control, which means to specify one color to mean transparent. The code is (in C#):

........ create a chart as usual using white (or any normal color as the background color) ..........

//output chart as usual
Bitmap b = (Bitmap)c.makeImage();

//set white color to mean transparent
b.MakeTransparent(Chart.NTime(0xffffff));

winChartViewer1.Image = b;

Also, after making the chart image transparent, you still need to make the WinChartViewer control transparent. This is by setting the BackColor property of the WinChartViewer control to Transparent (in the property window).

Finally, please note that transparent in any .NET Windows forms means transparent relative to the Form background. It means you can see through the control to see the Form background. The .NET framework does not support making any Windows Form control transparent relative to another Windows Form control.

Hope this can help.

Regards
Peter Kwan