frmsubjectname.cs

来自「实现课程表编排和打印功能,通过在候选列表中选择课程和教师(没有被排课且该教师教授」· CS 代码 · 共 72 行

CS
72
字号
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 frmSubjectName : Form
    {
        private string subjectName = "";
        public string SubjectName
        {
            get { return subjectName; }
        }

        private EditLevel editLevel = EditLevel.NULL;
        public EditLevel EditLevel
        {
            get { return editLevel; }
        }

        public frmSubjectName()
        {
            InitializeComponent();
            this.comboBox1.Enabled = true;
            LoadCombo();
        }

        public frmSubjectName(string oldName)
        {
            InitializeComponent();
            this.comboBox1.Enabled = false;
            this.textBox1.Text = oldName;
        }

        private void LoadCombo()
        {
            this.comboBox1.Items.Add(Utility.GetEditLevelString(EditLevel.小学));
            this.comboBox1.Items.Add(Utility.GetEditLevelString(EditLevel.初中));
            this.comboBox1.Items.Add(Utility.GetEditLevelString(EditLevel.高中));
            this.comboBox1.SelectedIndex = 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.subjectName = this.textBox1.Text;
            if (comboBox1.Enabled)
            {
                if (!Utility.CheckComboText(this.comboBox1))
                {
                    MessageBox.Show("请从列表框中选择科目级别?", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    this.editLevel = Utility.GetEditLevelObject(this.comboBox1.Text);
                }
            }
            this.DialogResult = DialogResult.Yes;
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.No;
            this.Close();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?