The following is my network-based applicationProgramAdapted a simple demo of the pallet program to implement the basic functions of the general pallet Program
Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;
Namespace windowsapplication4
{
Public partial class form1: Form
{
Private icon mneticon = new icon ("appmain. ICO ");
Private policyicon trayicon;
Private contextmenu policyiconmnu;
Public form1 ()
{
Initializecomponent ();
Initializenotifyicon ();
}
Private void form1_load (Object sender, eventargs E)
{
This. maximizebox = false;
This. minimizebox = false;
This. windowstate = system. Windows. Forms. formwindowstate. minimized;
}
private void initializenotifyicon ()
{< br> // set attributes of the pallet Program
trayicon = new policyicon ();
trayicon. icon = mneticon;
trayicon. TEXT = "using Visual C # As a pallet program";
trayicon. visible = true;
trayicon. click + = new system. eventhandler (this. click);
//// Define a menuitem array and assign the array to the contextmenu object at the same time
Menuitem [] mnuitms = new menuitem [1];
Mnuitms [0] = new menuitem ();
Mnuitms [0]. Text = "exit system ";
Mnuitms [0]. Click + = new system. eventhandler (this. showmessage );
Policyiconmnu = new contextmenu (mnuitms );
Trayicon. contextmenu = policyiconmnu;
/// Add the set contextmenu object to the tray Program
}
private void form=formclosed (Object sender, formclosedeventargs e)
{< br> trayicon. visible = false;
}< br> Public void click (Object sender, system. eventargs e)
{< br> MessageBox. show ("Visual C # compile the Event Response in the pallet program");
}
Public void showmessage (Object sender, system. eventargs E)
{
MessageBox. Show ("you have chosen to exit the system! ");
This. Close ();
}
}
}