各位网友帮我看看,使用NotifyIcon组件,为什么没在通知区域显示图标?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace NotifyIconExample
{
public partial class Form1 : Form
{
private bool isExit = false;
public Form1()
{
InitializeComponent();
notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
notifyIcon1.Visible = true;
notifyIcon1.BalloonTipText = "aaaaaaaa";
notifyIcon1.DoubleClick+=new System.EventHandler(this.notifyIcon1_DoubleClick);
this.ShowInTaskbar=false;
this.WindowState=FormWindowState.Minimized;
this.SetDesktopLocation(
Screen.PrimaryScreen.WorkingArea.Width-this.Width-20,
Screen.PrimaryScreen.WorkingArea.Height-this.Height-50);
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
if(this.WindowState==FormWindowState.Minimized)
{
this.WindowState=FormWindowState.Normal;
this.Activate();
}
else
{
this.WindowState=FormWindowState.Minimized;
}
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
isExit=true;
this.Close();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if(isExit==false)
{
this.WindowState=FormWindowState.Minimized;
e.Cancel=true;
}
}
}
}
用的是Microsoft visual stadio 2010
[解决办法]
那就是你写错了,或是没有设置好,请参考:
http://hi.baidu.com/jinmingmingha/blog/item/2f227df7838391f17609d7b5.html
http://blog.163.com/xiaozhu19890224@126/blog/static/1278957602010112202957414/
[解决办法]
NotifyIcon控件设置Icon属性了么?
[解决办法]
[解决办法]
+1
[解决办法]
notifyIcon1不设置ICON小图标 托盘中就不会显示