【问题标题】:Updated icon image won't show in document tab更新的图标图像不会显示在文档选项卡中
【发布时间】:2016-04-11 18:56:07
【问题描述】:

我刚刚找到了 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;
            }
        }

    }

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

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

注意:我一次尝试了这些。以上只是方法列表。

谁能帮我解决这个问题?谢谢! SgarciaV

【问题讨论】:

  • 或者,有没有办法改变 TabText 文本的颜色?

标签: c# dockpanel-suite


【解决方案1】:

我找到了解决方案。见这里:

Dockpanel Suite: Image not updating

【讨论】:

  • 您应该接受此答案以结束讨论。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-25
  • 1970-01-01
  • 1970-01-01
  • 2017-02-24
  • 2017-02-17
  • 1970-01-01
相关资源
最近更新 更多