* UMessageTip: 解决了Release模式下GDI位图未释放的Bug

This commit is contained in:
Sunny 2023-03-28 23:15:13 +08:00
parent 32d7ed3a05
commit 4727af34cd

View File

@ -12,7 +12,15 @@
* 使 * 使
****************************************************************************** ******************************************************************************
* : UMessageTip.cs * : UMessageTip.cs
* : UIMessageTip * :
* : V3.1
* : 2020-01-01
*
* 2020-01-01: V2.2.0
* 2023-03-28: V3.3.4 Release模式下GDI位图未释放的Bug
******************************************************************************
* : MessageTip.cs
* :
* : AhDung * : AhDung
* : https://www.cnblogs.com/ahdung/p/UIMessageTip.html * : https://www.cnblogs.com/ahdung/p/UIMessageTip.html
* : V2.0.0.2 * : V2.0.0.2
@ -20,7 +28,6 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@ -1406,7 +1413,7 @@ namespace Sunny.UI
} }
//销毁窗体 //销毁窗体
Debug.WriteLineIf(!DestroyWindow(_hWnd), "Failed", "DestroyWindow"); DestroyWindow(_hWnd);
_hWnd = IntPtr.Zero; _hWnd = IntPtr.Zero;
//注销窗口类 //注销窗口类
@ -1421,13 +1428,12 @@ namespace Sunny.UI
_wndClass = 0; _wndClass = 0;
} }
Debug.WriteLineIf(SelectObject(_dcMemory, _oldObj) == IntPtr.Zero, "Failed", "Restore _oldObj"); SelectObject(_dcMemory, _oldObj);
Debug.WriteLineIf(!DeleteDC(_dcMemory), "Failed", "Delete _dcMemory"); DeleteDC(_dcMemory);
Debug.WriteLineIf(!DeleteObject(_hBmp), "Failed", "Delete _hBmp"); DeleteObject(_hBmp);
_oldObj = IntPtr.Zero; _oldObj = IntPtr.Zero;
_dcMemory = IntPtr.Zero; _dcMemory = IntPtr.Zero;
_hBmp = IntPtr.Zero; _hBmp = IntPtr.Zero;
_disposed = true; _disposed = true;
} }
} }