Rectangle shape is not transparent

Hi,
I’m using Aspose.Slides v2.8.4.0.

I want to apply transparent color to background of Rectangle shape. I do code:

Shape shape = pres.Shapes.AddRectangle(x, y, w, h);
shape.LineFormat.ShowLines = false;
shape.FillFormat.Type = FillType.Solid;
shape.FillFormat.BackColor = Color.Transparent;
Link link = shape.AddLink();
link.SetExternalHyperlink(myAddress);

The shape is not transparent as I expect.

Please show me how to resolve.

Thanks,
Phuc Bui

Dear Phuc,

To make color transparent, you need to adjust alpha value of color, 0 means totally transparent while 255 means totally opaque.

Also, you will need FillFormat.ForeColor rather than FillFormat.BackColor e.g

Presentation pres = new Presentation();

Slide sld = pres.GetSlideByPosition(1);

int x = 100, y = 100, w = 2000, h = 1000;

Shape shape = sld.Shapes.AddRectangle(x, y, w, h);

shape.LineFormat.ShowLines = false;

shape.FillFormat.Type = FillType.Solid;

int alpha=155, red=255, green=200, blue=150;

shape.FillFormat.ForeColor =Color.FromArgb(alpha,red,green,blue);

pres.Write("c:\\out.ppt");

So cool. I thought that background color was used to make the shape transparency :slight_smile:

Thanks alot.