notifyicon控件是指定可在通知区域创建图标的组件,比如我们在右下角的状态栏想要显示某些东西,就可以使用这个控件
这个控件的属性和事件都特别简单,一般它会和ContextMenu一起使用,完成后的功能是下图这个样子的
1.界面布局
这个例程中主要我们是想看右下角的样子,所以主界面没有任何显示,只添加了三个控件
notifyicon,timer和contextMenu,当然我们需要给notifyicon添加图标,然后设置contextmenu为下图样子
2.代码示例
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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{