110,533
社区成员
发帖
与我相关
我的任务
分享
这是我的一段代码:
#region 窗体最小化到状态栏
private void MainForm_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.ShowInTaskbar == false)
{
notifyIcon1.Visible = true;
this.ShowInTaskbar = false;
this.Show();
this.Activate();
this.WindowState = FormWindowState.Normal;
}
}
#endregion
private void notifyIcon1_MouseMove(object sender, MouseEventArgs e)
{
notifyIcon1.Text = string.Format( "QQ:" +UserHelp.userNickName+"("+UserHelp.loginId+")"+"\n声音: 开启 \n消息提醒框: 关闭 \n会话消息: 任务栏头像闪动");
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.ShowInTaskbar = true;
notifyIcon1.Visible = false;
this.WindowState = FormWindowState.Normal;
this.Activate();
}
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
notifyIcon1.Visible = true;
this.Hide();
this.ShowInTaskbar = false;
}
}