Winfrom 捕获窗体最小化事件
C# WinForm 捕获最小化事件
虽然Form类没有提供Minimize的事件,但还是可以通过重载Deactive来实现
当Form失去焦点后,测试WindowState取得Form状态,若为Minimized既是最小化事件。
本例为最小化后隐藏窗口:
还有种方法更加直接,重载WndProc:
![](https://limon7.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://limon7.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
虽然Form类没有提供Minimize的事件,但还是可以通过重载Deactive来实现
当Form失去焦点后,测试WindowState取得Form状态,若为Minimized既是最小化事件。
本例为最小化后隐藏窗口: