ElementHost在调整大小时闪烁黑色边框 [英] ElementHost flickers black borders on resize

查看:254
本文介绍了ElementHost在调整大小时闪烁黑色边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

免责声明:这不是重复的帖子.我用Google搜索.另请阅读 SO问题.我尝试了其中一些方法,但似乎无济于事.

Disclaimer: This is not a duplicated post. I googled about the issue. Also read this, this and this SO questions. I tried some of those things but nothing seemed to help.

请考虑以下简单的示例代码.这只是一个空的 ElementHost (内部没有WPF控件):

Consider the following simple example code. It's just an empty ElementHost inside a WinForm (no WPF control inside):

using System.Windows.Forms;
using System.Windows.Forms.Integration;

namespace WindowsFormsApplication15
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            ElementHost host = new ElementHost();
            host.Dock = DockStyle.Fill;
            this.Controls.Add(host);
        }
    }
}

调整表单大小时,您会在表单边框处看到两个黑色边缘:

When you resize the form, you can see two black edges at the form border:

请问,有人可以为我的示例提供有效的解决方案,以解决此问题?

Please, ¿someone could give a working solution over my example to fix this issue?

推荐答案

该问题与ElementHost和Winforms无关.这只是一个WPF问题,我在以下SO问题中找到了答案:

The issue is not related to ElementHost and Winforms. It's just a WPF issue, and I found the answer in the following SO question:

如何解决WPF表单调整大小-控件滞后和黑色背景的问题?

这篇关于ElementHost在调整大小时闪烁黑色边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆