C#中如何让窗体透明而控件不透明?

2024-11-19 17:35:14
推荐回答(2个)
回答1:

我把我的方法给你看一下
public Form1()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.None;
this.ControlBox = false;

Point[] polyPoints ={
new Point (panel1.Location.X,panel1.Location.Y ),
new Point (panel1.Location.X + panel1.Width,panel1.Location.Y),
new Point (panel1.Location.X +panel1.Width ,panel1.Location.Y +panel1.Height),
new Point (panel1.Location.X,panel1.Location.Y +panel1.Height)
};
GraphicsPath path = new GraphicsPath();
path.AddPolygon(polyPoints);
Region region = new Region(path);
this.Region = region;
}

不知道能不能帮上忙

回答2:

试试把,代码写完就要多试试