C# transparent background for window form

前端 未结 4 1341
野趣味
野趣味 2021-01-12 15:40

I\'ve already seen Transparent background on winforms?

it doesnt offer solution to my problem. I am using the same method to try to achieve transparency



        
4条回答
  •  臣服心动
    2021-01-12 16:20

    public partial class TransprtScrcn : Form
        {
            public TransprtScrcn()
            {
                InitializeComponent();
                this.BackColor = Color.Red;
                this.TransparencyKey = Color.Red;
            }
    
    
            protected override void OnPaintBackground(PaintEventArgs e)
            {
                e.Graphics.FillRectangle(Brushes.Red, e.ClipRectangle);
            }
        }
    }
    

提交回复
热议问题