WPF doesn't always repaint when using WindowsFormsHost
I have a simple application which is hosting a Managed DirectX Control
using WindowsFormsHost
. I've overridden the paint methods in the Control
to prevent flicker:
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); }
}
There is a timer which periodically invalidates the Managed DirectX Control
so that it will be redrawn.
My problem is that when I lock the computer (WIN+L), and then unlock it, the WPF content around the WindowsFormsHost
occasionally does not get fully painted. Various portions of it are not drawn until I drag the window completely out of view. Any ideas on why WPF doesn't finish repainting itself?
Apologies if this is too vague 开发者_C百科to solve the issue, I'm unable to share more source code.
精彩评论