我有一个简单的应用程序,它使用Control
托管托管DirectX WindowsFormsHost
。我已经覆盖了Control
中的绘制方法以防止闪烁:
protected override void OnPaint(PaintEventArgs e)
{
if (this.Visible == true) { base.OnPaint(e); }
}
// Don't paint the background unless the control is not visible
protected override void OnPaintBackground(PaintEventArgs e)
{
if (this.Visible == false) { base.OnPaintBackground(e); }
}
有一个计时器会定期使Managed DirectX Control
无效,以便重新绘制它。
我的问题是,当我锁定计算机(WIN + L),然后将其解锁时,WindowsFormsHost
周围的WPF内容有时无法完全绘制。在我将窗口完全拖出视野之前,不会绘制它的各个部分。关于为什么WPF没有完成重绘的任何想法?
道歉,如果这个问题过于模糊,我无法分享更多源代码。