📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace testNotifyIconApp
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.NotifyIcon MyNotifyIcon;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.CheckBox checkBox1;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.MyNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// MyNotifyIcon
//
this.MyNotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("MyNotifyIcon.Icon")));
this.MyNotifyIcon.Text = "testNotifyIcon";
this.MyNotifyIcon.Visible = true;
this.MyNotifyIcon.DoubleClick += new System.EventHandler(this.MyNotifyIcon_DoubleClick);
//
// button1
//
this.button1.Location = new System.Drawing.Point(40, 32);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 24);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.toolTip1.SetToolTip(this.button1, "确认键");
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 96);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 24);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
this.toolTip1.SetToolTip(this.label1, "说明");
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(32, 160);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(80, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "textBox1";
this.toolTip1.SetToolTip(this.textBox1, "输入数字");
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(32, 216);
this.checkBox1.Name = "checkBox1";
this.checkBox1.TabIndex = 3;
this.checkBox1.Text = "checkBox1";
this.toolTip1.SetToolTip(this.checkBox1, "请选定");
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.checkBox1,
this.textBox1,
this.label1,
this.button1});
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.ShowInTaskbar = false;
this.Text = "testNotifyIcon";
this.toolTip1.SetToolTip(this, "tool1");
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void MyNotifyIcon_DoubleClick(object sender, System.EventArgs e)
{
if (this.Visible ){
this.Hide();
}
else {
this.Show();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -