我有一個選項,當它打開時選擇按鈕的問題,我做錯了什麼?單擊按鈕一次
private Boolean buttonWasClicked = false;
private void Button_Click(object sender, RoutedEventArgs e)
{
buttonWasClicked = true;
if (buttonWasClicked == true)
{
new SettingsWindow().Show();
var test = new SettingsWindow();
test.Owner = System.Windows.Application.Current.MainWindow;
test.WindowStartupLocation = WindowStartupLocation.CenterOwner;
test.Top = this.Top + 20;
}
else {
buttonWasClicked = false;
}
}`
的Winform或ASP.NET的出色答卷?你試圖做什麼BTW? – Rahul
在visual studio中使用WPF C# – Tjarda112
您正在創建'SettingsWindow'的兩個副本,您可能不想要這樣的問題 –