如何从"alt + tab"隐藏Winform或WPF应用程序?并从任务管理器的“应用程序"选项卡 [英] How to hide winform or WPF application from "alt+tab" and from task manager's application tab

查看:161
本文介绍了如何从"alt + tab"隐藏Winform或WPF应用程序?并从任务管理器的“应用程序"选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了许多与此主题相关的问题和答案,但没有找到更好的解决方案.很少有解决方案冗长,而且很少有解决方案.现在,我想为此分享一个简单易用的解决方案

I saw many questions and answers related to this topic But I didn't find any better solution. Few solution are lengthy and few doesn't work. Now I want to share a nice and easy solution for this

推荐答案

如何在 WPF 中使应用程序不可见.只需添加此XAML代码

How to make application invisible in WPF. just add this XAML code

<Window x:Class="temp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="350" Width="525" ResizeMode="NoResize" WindowState="Minimized" IsTabStop="False" Visibility="Hidden" WindowStyle="None" ShowInTaskbar="False">
<Grid>

</Grid>
</Window>

高度和宽度无关紧要Visibility, WindowStyle and ShowInTaskbar将从 Alt + Tab 和任务管理器的应用程序"选项卡中隐藏应用程序

Height and width dosn't matter only Visibility, WindowStyle and ShowInTaskbar will hide the application from Alt +Tab and from task manager's application tab

现在适用于Winform: 使用表单加载事件并输入以下代码

Now for Winform: Use Form load event and put this code

private void Form1_Load(object sender, EventArgs e)
{
    this.Opacity = 0; //Declear Opacity = 0 on top
    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; //This is most Important part don't use FormBorderStyle.None or something else
    this.WindowState = FormWindowState.Minimized;
    this.ShowInTaskbar = false;
}

这将隐藏Winform Application窗体的Alt +选项卡以及任务管理器的Application选项卡

This will Hide Winform Application form Alt+tab as well as from task manager's application tab

这篇关于如何从"alt + tab"隐藏Winform或WPF应用程序?并从任务管理器的“应用程序"选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆