[英]Updated icon image won't show in document tab
我刚刚找到DockPanel Suite,正在学习使用它。
我下载了v2.9,并将其与VS2013中的C#结合使用。 我创建了一个简单的Windows Forms 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
我找到了解决方案。 看这里:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.