📄 form1.cs
字号:
if (weeks == "星期一")
{
label3.Text = "Monday";
}
if (weeks == "星期二")
{
label3.Text = "Tuesday";
}
if (weeks == "星期三")
{
label3.Text = "Wednesday";
}
if (weeks == "星期四")
{
label3.Text = "Thursday";
}
if (weeks == "星期五")
{
label3.Text = "Friday";
}
if (weeks == "星期六")
{
label3.Text = "Saturday";
}
if (weeks == "星期日")
{
label3.Text = "Sunday";
}
}
else
{
button3.Text = "English";
label1.Text = "系统时间";
label2.Text = "今天";
groupBox1.Text = "设定";
label4.Text = "时间";
label5.Text = "星期";
button1.Text = "添加";
button2.Text = "删除";
Open.Text = "打开";
Save.Text = "保存";
label6.Text = "任务";
button4.Text = "隐藏";
label8.Text = "年 月 日";
label11.Text = "透明度";
button5.Text = "另存为";
listView1.Columns[0].Text = "年月日";
listView1.Columns[1].Text = "星期";
listView1.Columns[2].Text = "时间";
listView1.Columns[3].Text = "任务";
toolStripStatusLabel1.Text = "提醒您 :";
this.Text = "小秘书";
if (weeks == "Monday")
{
label3.Text = "星期一";
}
if (weeks == "Tuesday")
{
label3.Text = "星期二";
}
if (weeks == "Wednesday")
{
label3.Text = "星期三";
}
if (weeks == "Thursday")
{
label3.Text = "星期四";
}
if (weeks == "Friday")
{
label3.Text = "星期五";
}
if (weeks == "Saturday")
{
label3.Text = "星期六";
}
if (weeks == "Sunday")
{
label3.Text = "星期日";
}
label9.Text = System.DateTime.Now.ToLongDateString();
xq.Items.Clear();
string[] a = new string[] { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
xq.Items.AddRange(a);
}
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void 显示窗口ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
}
private void button4_Click(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Normal )
{
this.Visible = false;
}
}
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
this.Visible = false;
}
}
private void label9_Click(object sender, EventArgs e)
{
string strm, strm2;
strm =System .DateTime .Now .ToShortDateString ();
// MessageBox.Show(strm);
if (strm.Substring(6, 1) == "-")
{
if (strm.Substring(7, strm.Length - 7).Length == 1)
{
strm2 = strm.Substring(0, 5) + "0" + strm.Substring(5, 2) + "0" + strm.Substring(7, 1);
mtb2.Text = strm2;
}
else
{
strm2 = strm.Substring(0, 5) + "0" + strm.Substring(5, strm.Length - 5);
mtb2.Text = strm2;
}
}
else
{
if (strm.Substring(8, strm.Length - 8).Length == 1)
{
strm2 = strm.Substring(0, 8) + "0" + strm.Substring(8, 1);
mtb2.Text = strm2;
}
else
{
mtb2.Text =strm;
xq.Text = label3.Text;
}
}
}
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e) //透明度
{
this .Opacity =hScrollBar1 .Value /100.0 ;
label10.Text = hScrollBar1.Value.ToString() + "%";
}
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
this.Opacity = 1;
hScrollBar1.Value = 100;
}
private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
this.Opacity =0.8;
hScrollBar1.Value = 80;
}
private void toolStripMenuItem4_Click(object sender, EventArgs e)
{
this.Opacity = 0.6;
hScrollBar1.Value = 60;
}
private void toolStripMenuItem5_Click(object sender, EventArgs e)
{
this.Opacity = 0.4;
hScrollBar1.Value = 40;
}
private void toolStripMenuItem6_Click(object sender, EventArgs e)
{
this.Opacity = 0.2;
hScrollBar1.Value = 20;
}
private void button5_Click_1(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files(*.*)|*.*";
saveFileDialog1.FilterIndex = 1;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
SaveFile(saveFileDialog1.FileName);
}
}
private void 随Windows启动ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (rgqd.Checked == true)
{
WritePrivateProfileString("SET", "sjqd", "1", inipath); //wirte the control state
string Mypath = Application.ExecutablePath.ToString () ;
RegistryKey hklm = Registry.LocalMachine;
RegistryKey run = hklm.CreateSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
try
{
run.SetValue("小秘书.exe",@Mypath );
hklm.Close();
}
catch (Exception my)
{
MessageBox.Show(my.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else if (rgqd.Checked == false)
{
WritePrivateProfileString("SET", "sjqd", "0", inipath); //wirte the control state
RegistryKey hklm = Registry.LocalMachine ;
RegistryKey run = hklm.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
try
{
run.DeleteValue("小秘书.exe");
hklm.Close();
}
catch (Exception se)
{
MessageBox.Show(se.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void qdyc_Click(object sender, EventArgs e)
{
if (qdyc.Checked == true)
{
WritePrivateProfileString("SET", "qdyc", "1", inipath);
}
else
{
WritePrivateProfileString("SET", "qdyc", "0", inipath);
}
}
private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
{
string pathss = Directory.GetCurrentDirectory() + "\\小秘书帮助.chm";
Help.ShowHelp(this, pathss);
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
private void button6_Click(object sender, EventArgs e)
{
if (button6.Text == ">>")
{
this.ClientSize = new System.Drawing.Size(700, 310);
button6.Text = "<<";
}
else if (button6.Text == "<<")
{
this.ClientSize = new System.Drawing.Size(375, 310);
button6.Text = ">>";
}
}
private void notifyIcon_DoubleClick(object sender, EventArgs e)
{
}
private void contextMenuStrip1_DoubleClick(object sender, EventArgs e)
{
}
private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
{
}
private void tsk2_Click(object sender, EventArgs e)
{
tsk2.Checked = true;
tsk1.Checked = false;
}
private void tsk1_Click(object sender, EventArgs e)
{
tsk1.Checked = true;
tsk2.Checked = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -