Arasfon Asked:2020-09-15 14:08:04 +0000 UTC2020-09-15 14:08:04 +0000 UTC 2020-09-15 14:08:04 +0000 UTC 第一个事件 772 有必要在程序开始时进行检查Properties.Settings...Setting = 1;。但是,如果您将代码输入Window_Activated_1或输入Window_Loaded_1表单,它会出现一秒钟,同时另一个代码会启动。在加载第二个窗口之前,必须不显示第一个窗口。但第一个也很重要。在玩了Visibility这个窗口之后,它通常不再出现并加载任何东西。 c# 1 个回答 Voted Best Answer Андрей NOP 2020-09-15T14:12:46Z2020-09-15T14:12:46Z 打开 App.xaml 并删除 StartupUri 设置: <Application x:Class="WpfTest.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> </Application> 然后,打开 App.xaml.cs 并添加: protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); // Здесь код, который должен выполниться перед показом окна new MainWindow().Show(); }
打开 App.xaml 并删除 StartupUri 设置:
然后,打开 App.xaml.cs 并添加: