📄 frmclassname.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 课程安排
{
public partial class frmClassName : Form
{
private string className = "";
public string ClassName
{
get { return className; }
}
private DateTime classStartTime;
public DateTime ClassStartTime
{
get { return classStartTime; }
}
public frmClassName(Grade grade)
{
InitializeComponent();
this.textBox2.Enabled = true;
this.textBox2.Text = DateTime.Today.Year.ToString();
if (grade != null)
{
EditLevel el = Utility.GetEditLevel(grade.GradeName);
DateTime dt = Utility.GetStartTime(grade.GradeName, el);
this.textBox2.Text = dt.Year.ToString();
}
}
public frmClassName(string oldName)
{
InitializeComponent();
this.textBox1.Text = oldName;
this.textBox2.Enabled = false;
}
private void button1_Click(object sender, EventArgs e)
{
this.className = this.textBox1.Text;
if (GetDateTime() == false)
{
MessageBox.Show("所输入的年度错误,请重新输入,如'2008'", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.textBox2.Text = "";
return;
}
this.DialogResult = DialogResult.Yes;
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.No;
this.Close();
}
private bool GetDateTime()
{
bool b = false;
if (textBox2.Enabled == false) return true;
if (Utility.isYearString(this.textBox2.Text))
{
int year = Convert.ToInt32(this.textBox2.Text);
DateTime dt = new DateTime(year, 9, 1);
this.classStartTime = dt;
b = true;
}
return b;
//return Convert.ToDateTime(this.dateTimePicker1.Text);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -