如何固定界面大小啊?
我的程序要求在运行时最小化到右下角的托盘图标,双击托盘图标的时候再显示程序界面,如果点最小化按钮就又缩小到托盘图标。我现在遇到的问题是,每次双击托盘图标显示界面的时候,窗体都会闪几下,窗体长度也会变长一些,我就把窗体大小的代码加到双击托盘图标的事件里,结果还是不行,虽然界面不会变长了,但是窗体弹出的时候还是会闪几下,看起来非常不稳定,问下又没有什么办法让窗体稳定显示的?
private void LoadForm_Load(object sender, EventArgs e)
{
this.Visible = false;
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
this.Width = 294;
this.Height = 356;
}
private void LoadForm_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = false;
this.ShowInTaskbar = false;
}
}