System.Windows.Forms.ContextMenu nMenu;
EIPNotify EN;
private Icon m_Icon1;
public MainForm()
{
InitializeComponent();
Initializenotifyicon();
EN = new EIPNotify();
} private void MainForm_Load(object sender, EventArgs e)
{ }
private void Initializenotifyicon()
{
m_Icon1 = new Icon("OpenPet.ico");
niEIPNotify = new NotifyIcon();
niEIPNotify.Icon = m_Icon1;
niEIPNotify.Text = "EIPNotify";
niEIPNotify.DoubleClick += new EventHandler(ShowMainForm);
niEIPNotify.Visible = true; MenuItem[] MenuItems = new MenuItem[7];
MenuItems[0] = new MenuItem();
MenuItems[0].Text = "登入(&S)";
MenuItems[0].Click += new EventHandler(ShowMainForm);
MenuItems[1] = new MenuItem();
MenuItems[1].Text = "登出(&N)";
MenuItems[1].Click += new EventHandler(ShowMainForm);
MenuItems[2] = new MenuItem();
MenuItems[2].Text = "-";
MenuItems[3] = new MenuItem();
MenuItems[3].Text = "進入EIPOffice網站(&E)";
MenuItems[3].Click += new EventHandler(ExitMainForm);
MenuItems[4] = new MenuItem();
MenuItems[4].Text = "-";
MenuItems[5] = new MenuItem();
MenuItems[5].Text = "開啟EIPNotify(&O)";
MenuItems[5].Click += new EventHandler(ShowMainForm);
MenuItems[6] = new MenuItem();
MenuItems[6].Text = "結束(&X)";
MenuItems[6].Click += new EventHandler(ExitMainForm); nMenu = new ContextMenu(MenuItems);
niEIPNotify.ContextMenu = nMenu; }private void ShowMainForm(object sender, System.EventArgs e)
{ EN.Show();
EN.Activate();
//FN.WindowState = System.Windows.Forms.FormWindowState.Normal;
}
private void ExitMainForm(object sender, System.EventArgs e)
{
niEIPNotify.Visible = false;
this.Close();
}
EIPNotify EN;
private Icon m_Icon1;
public MainForm()
{
InitializeComponent();
Initializenotifyicon();
EN = new EIPNotify();
} private void MainForm_Load(object sender, EventArgs e)
{ }
private void Initializenotifyicon()
{
m_Icon1 = new Icon("OpenPet.ico");
niEIPNotify = new NotifyIcon();
niEIPNotify.Icon = m_Icon1;
niEIPNotify.Text = "EIPNotify";
niEIPNotify.DoubleClick += new EventHandler(ShowMainForm);
niEIPNotify.Visible = true; MenuItem[] MenuItems = new MenuItem[7];
MenuItems[0] = new MenuItem();
MenuItems[0].Text = "登入(&S)";
MenuItems[0].Click += new EventHandler(ShowMainForm);
MenuItems[1] = new MenuItem();
MenuItems[1].Text = "登出(&N)";
MenuItems[1].Click += new EventHandler(ShowMainForm);
MenuItems[2] = new MenuItem();
MenuItems[2].Text = "-";
MenuItems[3] = new MenuItem();
MenuItems[3].Text = "進入EIPOffice網站(&E)";
MenuItems[3].Click += new EventHandler(ExitMainForm);
MenuItems[4] = new MenuItem();
MenuItems[4].Text = "-";
MenuItems[5] = new MenuItem();
MenuItems[5].Text = "開啟EIPNotify(&O)";
MenuItems[5].Click += new EventHandler(ShowMainForm);
MenuItems[6] = new MenuItem();
MenuItems[6].Text = "結束(&X)";
MenuItems[6].Click += new EventHandler(ExitMainForm); nMenu = new ContextMenu(MenuItems);
niEIPNotify.ContextMenu = nMenu; }private void ShowMainForm(object sender, System.EventArgs e)
{ EN.Show();
EN.Activate();
//FN.WindowState = System.Windows.Forms.FormWindowState.Normal;
}
private void ExitMainForm(object sender, System.EventArgs e)
{
niEIPNotify.Visible = false;
this.Close();
}
{ EN.Show(); // 就是這兒錯了
EN.Activate();
//FN.WindowState = System.Windows.Forms.FormWindowState.Normal;
}就是這兒錯了, 謝謝各位.
什麼意思呢?
忘了說了,雙擊開啟的主窗體名稱叫EIPNotify
==>
this.hide();
都关闭了还要显示??
----------------------
你要访问的对象已经被你释放了!检查代码