You can't set an opacity for a panel: it's a function of top level windows (such as forms) only - it is a hardware function that isn't enabled for child windows such as Panel.
You can - sort of - do it, by setting the panel background colour to an Alpha value of zero, but...it's not very good!
public frmMain()
{
InitializeComponent();
myPanel.BackColor = Color.FromArgb(0, Color.Black);
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawLine(Pens.Red, 0, 0, Width, Height);
}