Original Post
Hello, I am trying to create semitransparent panel (for example, which is 50% opaque). So I wrote the following code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace Visata
{
public class TransparentPanel :Panel
{
public TransparentPanel()
{
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Exstyle |= 0x20;
return cp;
}
}
protected override void OnPaintBackground(PaintEventArgs e)
{
}
}
}
After this I tried to add TransparentPanel to my form. I noticed that this panel is absolutely invisible. Where is the problem? How to create a panel, which is, for example, blue and semitransparent (opacity is 50%)?. Thanks in advance.