--- lang: ja-jp breaks: true --- # C# Window を 表示してすぐ閉じるまでの 処理時間計測 2022-03-29 * .NET Framework WPF Window :0.22秒~0.28秒 * .NET Framework Form :0.14秒~0.18秒 ## WPF ```csharp= Stopwatch sw = new Stopwatch(); sw.Start(); Window1 win = new Window1(); win.WindowStartupLocation = WindowStartupLocation.CenterOwner; win.Owner = this; win.ShowDialog(); // Loaded で Close(); sw.Stop(); textBox1.Text = sw.Elapsed.ToString(); ``` ## Form ```csharp= Stopwatch sw = new Stopwatch(); sw.Start(); Form2 form = new Form2(); form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(); // Shown で Close(); sw.Stop(); this.textBox1.Text = sw.Elapsed.ToString(); ``` ###### tags: `C#` `Window` `処理時間計測` `WPF` `WinForm`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up