在.NET中创建新的最大化的MDI子窗体与图标问题 [英] Problem with icon on creating new maximized MDI child form in .NET

查看:94
本文介绍了在.NET中创建新的最大化的MDI子窗体与图标问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net 3.5 MDI WinForms应用程序。

I have a .NET 3.5 MDI WinForms application.

我设置AA子窗体的图标属性和正确的图标显示在表格的左上角。然后,我最大的子窗体和图标还行。

I set a a child form's Icon property, and the icon shows up correctly in the top left corner of the form. I then maximize the child form and the icon is still OK.

和孩子在一起的形式仍然最大化的,我打开另一个子窗口,它会自动大作最大化。这种形式的图标是不是一个在图标属性,但是默认的.NET图标(一个与蓝色,红色和黄色方块)。不过,如果我的调整的MDI父窗体,图标本身并显示正常复位。

With the child form still maximized, I open another child window, which automatically comes up maximized. This form's icon is not the one in the Icon property, but the default .NET icon (the one with the blue, red, and yellow squares). However, if I resize the MDI parent form, the icon resets itself and displays properly.

有没有人有一个解决办法或知道为什么会这样?

Does anyone have a workaround or know why this happens?

推荐答案

右键我已经找到了解决办法...

Right I have found a solution...

的解决方法是对的子窗体的加载事件再次设置图标如下:

The workaround for this is to set the icon again on the load event of the child form as follows:

private void StatsForm_Load(object sender, EventArgs e)
{
    //bug that means you have to set the desired icon again otherwise it reverts to default when child form is maximised
    Icon = new System.Drawing.Icon("research.ico");
}

这并不意味着你必须首先有问题的图标文件添加到您的VS项目/解决方案,并将其设置为一直拷贝,这样,当你的解决方案是建立被复制。

This does mean that you will have to first add the icon file in question into your VS project/solution and set it to "Copy Always" so that is copied when your solution is built.

HTH 中华哲

这篇关于在.NET中创建新的最大化的MDI子窗体与图标问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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