现有一mdi窗体,一个子窗体,更改了子窗体的图标,但是在mdi窗体里打开子窗体时,显示的还是默认的图标,最大化和最小化子窗体时,才显示更改过的图标,这是怎么回事,有人遇到过吗
mdi打开子窗体的代码:
form1 fr = new form1 ();
fr.MdiParent = this;
fr.WindowState = FormWindowState.Maximized;
fr.Show();
mdi打开子窗体的代码:
form1 fr = new form1 ();
fr.MdiParent = this;
fr.WindowState = FormWindowState.Maximized;
fr.Show();
fr.MdiParent = this;
fr.WindowState = FormWindowState.Maximized;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication53
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); this.Icon = new Icon(@"c:\1.ico");
this.IsMdiContainer = true;
Form F = new Form();
F.Icon = this.Icon;
F.MdiParent = this;
F.Show();
}
}很正常,子窗口icon变成和主窗口一样
fr.MdiParent = this; fr.Show();fr.WindowState = FormWindowState.Maximized; //改下顺序