是否可以在TaskManager应用程序选项卡中隐藏winform?

adi*_*sba 9 .net c# taskmanager winforms

我正在编写一个透明的WinForms应用程序,我想隐藏应用程序在任务管理器的应用程序选项卡中显示.我很好,因为它会在进程中显示(事实上它应该).如果我设置:

this.ShowInTaskbar = false;
Run Code Online (Sandbox Code Playgroud)

它只隐藏在任务栏中.

完整的代码,我有一个由标签制成的计时器

        public Form1()
    {
        InitializeComponent();
        this.BackColor = Color.LimeGreen;
        this.TransparencyKey = Color.LimeGreen;
        Timer time = new Timer();
        time.Interval = 1000;
        time.Tick += new EventHandler(time_Tick);
        time.Start();
        this.ShowInTaskbar = false;


    }

    void time_Tick(object sender, EventArgs e)
    {
        label1_hour.Text = DateTime.Now.Hour.ToString() ;
        label_minute.Text = DateTime.Now.Minute.ToString();
        label_second.Text = DateTime.Now.Second.ToString();
    }
Run Code Online (Sandbox Code Playgroud)

Met*_*Man 30

尝试这样的事情

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        this.FormBorderStyle = FormBorderStyle.None;
        this.ShowInTaskbar = false;
    }
    protected override CreateParams CreateParams {
        get {
            var cp = base.CreateParams;
            cp.ExStyle |= 0x80;  // Turn on WS_EX_TOOLWINDOW
            return cp;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

  • 不工作.它仍然显示在进程选项卡中 (2认同)