gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 17:29:04 25 4
gpt4 key购买 nike

我正在编写一个透明的 WinForms 应用程序,我想隐藏该应用程序,使其不显示在任务管理器的应用程序选项卡中。我同意它会显示在流程中(事实上它应该)。如果我设置:

this.ShowInTaskbar = false;

它只隐藏在任务栏上。

完整代码我有我有一个用标签制作的计时器

        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();
}

最佳答案

尝试这样的事情

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;
}
}
}

关于c# - 是否可以在 TaskManager 应用程序选项卡中隐藏 winform?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9232291/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com