I have a custom graphing usercontrol which has support for transparent backcolor. During design, the usercontrol shows properly. However, on runtime, the backcolor turns black.
I have searched stackoverflow for a solution, but most of the articles refer to WPF or controllers. :(
Things I have tried:
I have tried using a transparentpanel usercontrol to house the graphing usercontrol. This changed nothing. I set the graphing usercontrol to use the transparentpanel as the parent, nothing.
Does anybody have any input on how to prevent this from happening? Thank you.
Update 1: If I just add the graphing usercontrol to the form and run the app, the transparency still works. It seems to be an issue when it starts graphing. I have tried the following solutions.
protected override CreateParams CreateParams
{
get
{
CreateParams parameters = base.CreateParams;
parameters.ExStyle |= WS_EX_TRANSPARENT;
return parameters;
}
}
internal const int WS_EX_TRANSPARENT = 0x00000020;
I also tried adding:
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);