📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace NetFax
{
public partial class Form1 : Form
{
private Icon m_Icon1;
private Icon m_Icon2;
private bool m_bFlag;
private bool m_bShowWnd;
public Form1()
{
InitializeComponent();
m_bFlag = true;
m_bShowWnd = true;
try
{
m_Icon1 = new Icon("tray1.ico");//导入图标文件
m_Icon2 = new Icon("tray2.ico");
}
catch (Exception e)
{
MessageBox.Show("error");
}
timer1.Start();
}
private void button1_Click(object sender, EventArgs e)
{
SetForm setform = new SetForm();
setform.Show();
}
private void button2_Click(object sender, EventArgs e)
{
SendFax sendfax = new SendFax();
sendfax.Show();
}
private void notifyIcon1_Click(object sender, EventArgs e)
{
if (m_bShowWnd == true)//隐藏主界面
{
this.Visible = false;
m_bShowWnd = false;
}
else//显示主界面
{
this.Visible = true;
m_bShowWnd = true;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (m_Icon1 != null && m_Icon2 != null) //如果两个图标文件都被正确载入
{
//只要timer1被启动,则在两个图标之间不断进行选择变换,实现动画效果
if (m_bFlag == true)
{
notifyIcon1.Icon = m_Icon2;
m_bFlag = false;
}
else
{
notifyIcon1.Icon = m_Icon1;
m_bFlag = true;
}
}
}
private void button3_Click(object sender, EventArgs e)
{
About about = new About();
about.ShowDialog();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -