日期:2014-05-18 浏览次数:21086 次
public partial class Timer : Form
{
private NotifyIcon ni;
public Timer()
{
InitializeComponent();
// 实例化图标组件
this.ni = new NotifyIcon();
this.ni.Icon = 指定托盘区图标;
this.ni.Visible = true;
// 设置窗体样式
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false;
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
// 设置隐藏
this.Visible = false;
}
}
------解决方案--------------------
this.Hide();
------解决方案--------------------
当前窗体.Hide()就可以啊
------解决方案--------------------
在窗体的构造函数里面写
this.ShowInTaskbar = false;
this.FormBorderStyle = FormBorderStyle.None;
------解决方案--------------------
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.Visible = false;
}