使用 WindowsFormsHost 时 WPF 并不总是重绘
我有一个简单的应用程序,它使用 WindowsFormsHost
托管托管 DirectX Control
。我已经重写了 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 没有完成自身重绘的任何想法?
抱歉,如果这太模糊而无法解决问题,我无法分享更多源代码。
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 to solve the issue, I'm unable to share more source code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论