c# 创建一个 透明 穿透 form ,屏幕字幕之类的

namespace UnActiveFormTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
           
            InitializeComponent();
            this.Opacity = 0.5;
            this.TopMost = true;

        }
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams createParams = base.CreateParams;
                if (!base.DesignMode)
                {
                    createParams.ExStyle |= 32;
                    createParams.ExStyle |= 8;
                }
                return createParams;
            }
        }
        protected override bool ShowWithoutActivation
        {
            get { return true; }
        }
    }
}

 

posted @ 2022-01-20 11:05  interim  阅读(122)  评论(0编辑  收藏  举报