D1187:在未完成 Dc 上调用 SetTarget

SetTarget 是在 GetDC ReleaseDC/ 对之间调用的。

 

可能的原因

应用程序获取了 ID2D1GdiInteropRenderTarget 并调用其 GetDC 方法,然后在调用 ReleaseDC 之前调用 FlushEndDraw

可能的修复方法

确保在调用 FlushEndDraw 之前应用程序调用 ReleaseDC,并且对 ReleaseDC 的每个调用都与对 GetDC 的先前调用匹配。 如果应用程序当前正在使用 GDI 设备上下文,Direct2D 将不会尝试对 GDI 目标资源进行作。