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

2024年11月19日 17:35
有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):

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