我有这样的代码:
public form()
{
InitializeComponent();
init(); //read ini and try to minimize
}
private void timer1_Tick(object sender, EventArgs e)
{
}
and in ini method I minimize form and hide it(in debug i can see form.visible = false), but when it leaves init method then it jumps on timer and change visible = true and i can see my app in taskbar and tray. I want see only tray icon. I use this to minimize form to tray.
到目前为止,我做了这个, 但也许被错误地应用了 因为当表单显示时 形式像清新, 它看起来怪怪的。
private void notifyIcon1_Click(object sender, EventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
}
private void minimizeWindow()//this method is called on form resize
{
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
else if (FormWindowState.Normal == this.WindowState)
{
notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
}
}