0
A
回答
0
您可以使用WPF窗口的關閉事件,取消關閉,而是將其最小化:
XAML:
<Window ... Closing="Window_Closing">
後面的代碼:
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.WindowState = WindowState.Minimized;
}
但是你必須要意識到這也阻止了關閉窗口的其他方式,例如Alt + F4,從工具欄中的「關閉窗口」等。
+0
或者,如果你不想關閉到最小化(這真的很難從你的問題中知道),只需使用該行'this.WindowState = WindowState.Minimized; '無論你想讓窗口最小化。 – 2011-03-26 19:16:44
+0
凱特感謝我用你的解決方案... – cetin 2011-03-26 20:05:41
0
相關問題
- 1. 爲什麼我必須使用Application類來使用WPF窗口?
- 2. 必須指向分支?
- 3. Windows窗體:文本框必須顯示變量的值
- 4. WPF ControlTemplates是否必須具有TargetType?
- 5. 項目集合必須爲空。 WPF datagridtable
- 6. Django窗體嚮導:訪問窗體中的上下文
- 7. WPF或Windows窗體
- 8. 必須刪除意向演員嗎?
- 9. Foursquare重定向uri必須是https?
- 10. 必須是變體或對象
- 11. 實體必須設法調用刪除
- 12. 窗體重定向
- 13. WPF - 向左擴展窗口
- 14. WPF窗體+ MDI中的Winforms
- 15. 從Windows窗體到WPF
- 16. WPF與Windows窗體 - STAThread
- 17. WPF DataGrid與Windows窗體DataGridView
- 18. 集成WPF和Windows窗體
- 19. 在Windows窗體或WPF
- 20. 共存Windows窗體和WPF
- 21. 從窗體遷移到WPF
- 22. WPF窗體顯示爲winform
- 23. 顯示在WPF Windows窗體
- 24. 使用Windows窗體的WPF
- 25. Windows窗體中WPF用戶控件的雙向DataBinding
- 26. 'GridView'類型的控件'GridView1'必須放置在runat = server的窗體標籤中。
- 27. WIF - 聯合提供者MVC應用程序還是它必須是Web窗體?
- 28. NET Windows窗體datagridview - 必須單擊組合框三次才能獲得焦點
- 29. 'Menu'類型的控件'Menu1'必須放置在窗體標籤內,runat = server
- 30. 索引必須在列表的範圍內 - Windows窗體應用程序
你正在尋找的詞是最小化。你問在代碼中如何做到這一點? – 2011-03-26 18:41:54
是的凱特 - 我完全想要這 – cetin 2011-03-26 18:50:40