使用WindowsFormsHost时,WPF并不总是重绘

时间:2010-04-05 19:53:36

标签: wpf winforms paint managed-directx windowsformshost

我有一个简单的应用程序,它使用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没有完成重绘的任何想法?

道歉,如果这个问题过于模糊,我无法分享更多源代码。

0 个答案:

没有答案