C#中如何让窗体透明而控件不透明?
C#中如何让窗体透明而控件不透明?我在窗体加入一个控件Panel,我把窗体调成透明,但我希望Panel不透明,请问如何做得出来?高手指教下!谢谢!...
C#中如何让窗体透明而控件不透明?我在窗体加入一个控件Panel,我把窗体调成透明,但我希望Panel不透明,请问如何做得出来?高手指教下!谢谢!
展开
2个回答
展开全部
我把我的方法给你看一下
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;
}
不知道能不能帮上忙
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;
}
不知道能不能帮上忙
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询