UPDATE : Quote:
The WinForms implementation of Form only permits a solid colour to be used as the transparency key. It's not possible to have varying levels of transparency.
Hello,
I'm actually working with Windows Forms and GDI+.
I've got my background with a color that i MakeTransparent when I save my image as png later.
I have to draw some polygons on this background.
I also have to draw a closed curve filled with a linear gradient brush, going from white to transparent color.
The problem is, when I save the form as a png, the gradient brush is going from white to dark gray/black. It's like if i loose the transparency wanted when i fill my curve with my gradient brush.
I've got something like that :
https://image.noelshack.com/fichiers/2020/37/1/1599462293-transparent.png[
^]
The red part is transparent (it's without the gradient brush).
Thanks for all the help that you can bring me to.
What I have tried:
This is my gradient brush :
LinearGradientBrush linGrBrush2 = new LinearGradientBrush(closedCurveRect, Color.FromArgb(94, 94, 94), Color.Transparent, LinearGradientMode.Vertical);
And I try to fill my closed curve like that :
g.FillClosedCurve(linGrBrush2, closedCurve.ToArray(), FillMode.Alternate, tension);
When I save my image, I convert my background to transparent :
bmp1.MakeTransparent(Color.FromArgb(94, 94, 94));
bmp1.Save(filename + ".png", pngEncoder);