http://www.mastercsharp.com/article.aspx?ArticleID=23&&TopicID=8
解决方案 »
- 文件传输问题
- 如何更改sql server 2005 的默认时间格式
- 车辆在公路走,怎么goole地图也跟着走,怎么做啊,求高手指教
- listview的性能太低.有没有办法提高他加载数据的能力?
- C#串口开发群11235237
- 关于ajax中post请求 与 jquery中的post请求
- 新建类调用主窗口类里的函数问题
- 新手 关于用Installer发布C#程序后的调试问题
- 有谁能给我说说Hashtable class和ManualResetEvent class 是怎么一回事?
- 只谈C#不谈XML是为不智! C#+XML岂是JAVA所能及?(Sun也太落后了在XML上至少比MS落后2年)
- 怎样用代码设置控件的tooptip属性?
- 用C#如何查找任务管理里的进程?有源代码嘛?
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class TrayIcon : System.Windows.Forms.Form
{
private System.Windows.Forms.NotifyIcon notifyIcon1;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.RichTextBox tbox;
private System.ComponentModel.IContainer components; public TrayIcon()
{
//
// Required for Windows Form Designer support
//
InitializeComponent(); //
// TODO: Add any constructor code after InitializeComponent call
//
} /// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TrayIcon));
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.tbox = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// notifyIcon1
//
this.notifyIcon1.ContextMenu = this.contextMenu1;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "黄易帖";
this.notifyIcon1.Visible = true;
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem3,
this.menuItem4});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "显示";
this.menuItem1.Click += new System.EventHandler(this.maximize);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "隐藏";
this.menuItem2.Click += new System.EventHandler(this.minimise);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.Text = "帮助";
this.menuItem3.Click += new System.EventHandler(this.helpme);
//
// menuItem4
//
this.menuItem4.Index = 3;
this.menuItem4.Text = "退出";
this.menuItem4.Click += new System.EventHandler(this.exit);
//
// tbox
//
this.tbox.BackColor = System.Drawing.Color.Orange;
this.tbox.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbox.Name = "tbox";
this.tbox.Size = new System.Drawing.Size(242, 203);
this.tbox.TabIndex = 0;
this.tbox.Text = "今日要事\n9:00 与测试处联系测试事宜\n10:00 和电信局客户见面\n14:00 小组讨论数据库设计";
//
// TrayIcon
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.Orange;
this.CausesValidation = false;
this.ClientSize = new System.Drawing.Size(242, 203);
this.ContextMenu = this.contextMenu1;
this.ControlBox = false;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.tbox});
this.MaximizeBox = false;
this.Name = "TrayIcon";
this.ShowInTaskbar = false;
this.Text = "黄易帖";
this.TopMost = true;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.ResumeLayout(false); }
#endregion /// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new TrayIcon());
} private void maximize(object sender, System.EventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
if(!this.Visible)
{
//If the Window is hidden
//Show it
this.Show();
}
} private void minimise(object sender, System.EventArgs e)
{
if(this.Visible)
{
//Hide the Application
this.Hide();
}
} private void helpme(object sender, System.EventArgs e)
{
MessageBox.Show("版权所有:XXX 2001") ;
} private void exit(object sender, System.EventArgs e)
{
//Call the Dispose Method
this.Close();
}
}
}