且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

启动时完全隐藏WPF窗口吗?

更新时间:2023-02-17 20:51:46

HB方法的一种替代方法是将 Visibility 设置为隐藏,然后将 ShowInTaskbar 设置为错误的.这仍然会创建窗口并让其执行操作.

An alternative to H.B.'s method is just to set the Visibility to hidden and set ShowInTaskbar to false. This still creates the window and lets it do its thing.

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525" ShowInTaskbar="False" Visibility="Hidden">
    <Grid>

    </Grid>
</Window>