1. 首页
  2. 数据库
  3. 其它
  4. C#实现WinForm捕获最小化事件的方法

C#实现WinForm捕获最小化事件的方法

上传者: 2020-12-30 15:33:59上传 PDF文件 37.52KB 热度 15次
一般来说,虽然Form类没有提供Minimize的事件,但还是可以通过重载Deactive来实现WinForm捕获最小化事件。 实现方法为:当Form失去焦点后,测试WindowState取得Form状态,若为Minimized既是最小化事件。 本例为最小化后隐藏窗口: 还有种方法更加直接,重载WndProc: 实现代码如下: const int WM_SYSCOMMAND = 0x112; const int SC_CLOSE = 0xF060; const int SC_MINIMIZE = 0xF020; const int SC_MAXIMIZE = 0xF030; protecte
下载地址
用户评论