【问题标题】:How to hide winform or WPF application from "alt+tab" and from task manager's application tab如何从“alt+tab”和任务管理器的应用程序选项卡中隐藏 winform 或 WPF 应用程序
【发布时间】:2014-05-15 16:08:37
【问题描述】:

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

【问题讨论】:

    标签: wpf winforms hide


    【解决方案1】:

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

    <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 和任务管理器的应用程序选项卡中隐藏应用程序

    现在是 Winform: 使用表单加载事件并输入此代码

    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 应用程序表单 Alt+tab 以及任务管理器的应用程序选项卡

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      • 2016-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多