日期:2014-05-18  浏览次数:20870 次

Form窗体背景透明
一个Form窗体,属性FormBorderStyle:None,我用设计窗体的外观,Panel都透明,用.png的图片填充panel背景,我想实现窗体的四个角有椭圆的效果,但是运行后,四个角有颜色:Control,我PS的那四个角是透明,是椭圆的。

  我想要这个效果该怎么做?

------解决方案--------------------
C# code

    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();

            using (GraphicsPath path = new GraphicsPath())
            {
                int r = 32;//圆角半径
                path.AddArc(0, 0, r, r, 180, 90);
                path.AddArc(this.Width - r - 1, 0, r, r, 270, 90);
                path.AddArc(this.Width - r - 1, this.Height - r - 1, r, r, 0, 90);
                path.AddArc(0, this.Height - r - 1, r, r, 90, 90);
                this.Region = new Region(path);
            }
        }
    }

------解决方案--------------------
但是如果有渐变淡出效果ls的都不行吧
看这个吧
A lovely goldfish desktop pet (using alpha-PNG and GDI+)