更新的图标图像不会显示在文档选项卡中



我刚找到DockPanel Suite,正在学习使用它。

我下载了v2.9,并在VS2013中与C#一起使用。我创建了一个简单的Windows窗体MDI应用程序。它有一种类型的子窗体,这是一个简单的窗体,其中只有一个富文本框控件。我在文档的选项卡上添加了一个图标,指示富文本框文本是否已保存。

每当用户通过使用text_Changed事件在富文本框中键入时,我都会更改选项卡图标:

private void txtCode_TextChanged(object sender, EventArgs e)
    {
        //The text has changed, set the warning icon.
        this.Icon = MyApp.Properties.Resources.Warning;
    }

我遇到的问题是图标在全速运行时不会更新。当我单步完成上述事件时,它会很好地更新。当我在表单的load事件中加载文件时,它也会更新得很好;

private void frmCode_Load(object sender, EventArgs e)
    {
        //Get the full file path.
        string sFile = Path.Combine(cCoCoIDE.CodeBaseRootFolder, Path.GetFileNameWithoutExtension(cCoCoIDE.CodeBaseFile), this.Text);
        //Load the source file into the code window.
        //A few validations.
        //Make sure the file exists.
        if (File.Exists(sFile))
        {
            //File is there. Is it empty? Load only if not empty.
            if (new FileInfo(sFile).Length > 0)
            {
                txtCode.LoadFile(sFile);
                //I had to add the following because the text changed
                //event fires when I load the file and I need to start
                //off with the green checkmark icon.
                this.Icon = CoCoIDE.Properties.Resources.GreenChk;
            }
        }
    }

我在更改图标后(在文本更改事件中)尝试了以下操作:

            this.ShowIcon = true;
            this.Refresh();
            this.Update();

注意:我一次试一个。以上只是方法列表。

有人能帮我吗?非常感谢。SgarciaV

我找到了解决方案。请参阅此处:

Dockpanel套件:图像未更新

最新更新