I'm trying to animate a user-control which has transparent backcolor. While animating (i.e. moving control up-down in vertical direction) user-control the backcolor does not refresh.
I have placed the control on the top of picturebox and then animating it. The picturebox has gradeitn color as backcolor with bottom starting as red to blue. Also user-control has traingle shape on it.
Code is in C# on windows OS.
I tried so many options but still facing same issue.Below is the code :
namespace AC
{
public partial class MyTriangle: UserControl
{
public MyTriangle()
{
InitializeComponent();
DefaultSettings();
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;
}
/// <summary>
/// Method for Transparent background
/// </summary>
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x20;
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
}
protected void InvalidateEx()
{
this.Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
//base.OnPaint(e);
}
}
}
i believe whatever change we need to do is int user-control only. Please see attached traingle shape (tmp.png) and picturebox color (tmp1.png)![enter image description here][1] for reference.![enter image description here][2]
Thanks