📄 form1.h
字号:
#pragma once
#include "选课结果.h"
namespace course {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Form1 摘要
///
/// 警告: 如果更改此类的名称,则需要更改
/// 与此类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。否则,
/// 设计器将不能与此窗体的关联
/// 本地化资源正确交互。
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
}
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::TabControl^ tabControl1;
protected:
private: System::Windows::Forms::TabPage^ tabPage1;
private: System::Windows::Forms::TabPage^ tabPage2;
private: System::Windows::Forms::ComboBox^ comboBox1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::RadioButton^ radioButton2;
private: System::Windows::Forms::RadioButton^ radioButton1;
private: System::Windows::Forms::Button^ button6;
private: System::Windows::Forms::Button^ button5;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::ListBox^ listBox2;
private: System::Windows::Forms::ListBox^ listBox1;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button1 = (gcnew System::Windows::Forms::Button());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label1 = (gcnew System::Windows::Forms::Label());
this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
this->button6 = (gcnew System::Windows::Forms::Button());
this->button5 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->listBox2 = (gcnew System::Windows::Forms::ListBox());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->tabControl1->SuspendLayout();
this->tabPage1->SuspendLayout();
this->groupBox1->SuspendLayout();
this->tabPage2->SuspendLayout();
this->SuspendLayout();
//
// tabControl1
//
this->tabControl1->Controls->Add(this->tabPage1);
this->tabControl1->Controls->Add(this->tabPage2);
this->tabControl1->HotTrack = true;
this->tabControl1->Location = System::Drawing::Point(12, 12);
this->tabControl1->Name = L"tabControl1";
this->tabControl1->SelectedIndex = 0;
this->tabControl1->Size = System::Drawing::Size(306, 267);
this->tabControl1->TabIndex = 0;
//
// tabPage1
//
this->tabPage1->Controls->Add(this->comboBox1);
this->tabPage1->Controls->Add(this->textBox1);
this->tabPage1->Controls->Add(this->groupBox1);
this->tabPage1->Controls->Add(this->button2);
this->tabPage1->Controls->Add(this->button1);
this->tabPage1->Controls->Add(this->label2);
this->tabPage1->Controls->Add(this->label1);
this->tabPage1->Location = System::Drawing::Point(4, 22);
this->tabPage1->Name = L"tabPage1";
this->tabPage1->Padding = System::Windows::Forms::Padding(3);
this->tabPage1->Size = System::Drawing::Size(298, 241);
this->tabPage1->TabIndex = 0;
this->tabPage1->Text = L"登记";
this->tabPage1->UseVisualStyleBackColor = true;
//
// comboBox1
//
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"软件学院", L"电子系", L"历史系", L"法学院"});
this->comboBox1->Location = System::Drawing::Point(127, 126);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System::Drawing::Size(121, 20);
this->comboBox1->TabIndex = 6;
this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::comboBox1_SelectedIndexChanged);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(127, 22);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(121, 21);
this->textBox1->TabIndex = 5;
//
// groupBox1
//
this->groupBox1->Controls->Add(this->radioButton2);
this->groupBox1->Controls->Add(this->radioButton1);
this->groupBox1->Location = System::Drawing::Point(62, 49);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(186, 61);
this->groupBox1->TabIndex = 4;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"性别";
//
// radioButton2
//
this->radioButton2->AutoSize = true;
this->radioButton2->Location = System::Drawing::Point(111, 29);
this->radioButton2->Name = L"radioButton2";
this->radioButton2->Size = System::Drawing::Size(35, 16);
this->radioButton2->TabIndex = 1;
this->radioButton2->Text = L"女";
this->radioButton2->UseVisualStyleBackColor = true;
//
// radioButton1
//
this->radioButton1->AutoSize = true;
this->radioButton1->Checked = true;
this->radioButton1->Location = System::Drawing::Point(43, 29);
this->radioButton1->Name = L"radioButton1";
this->radioButton1->Size = System::Drawing::Size(35, 16);
this->radioButton1->TabIndex = 0;
this->radioButton1->TabStop = true;
this->radioButton1->Text = L"男";
this->radioButton1->UseVisualStyleBackColor = true;
//
// button2
//
this->button2->Location = System::Drawing::Point(173, 181);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 23);
this->button2->TabIndex = 3;
this->button2->Text = L"退出";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// button1
//
this->button1->Location = System::Drawing::Point(49, 181);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 2;
this->button1->Text = L"选课";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(60, 129);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(29, 12);
this->label2->TabIndex = 1;
this->label2->Text = L"院系";
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(60, 25);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(29, 12);
this->label1->TabIndex = 0;
this->label1->Text = L"姓名";
//
// tabPage2
//
this->tabPage2->Controls->Add(this->button6);
this->tabPage2->Controls->Add(this->button5);
this->tabPage2->Controls->Add(this->button4);
this->tabPage2->Controls->Add(this->button3);
this->tabPage2->Controls->Add(this->listBox2);
this->tabPage2->Controls->Add(this->listBox1);
this->tabPage2->Location = System::Drawing::Point(4, 22);
this->tabPage2->Name = L"tabPage2";
this->tabPage2->Padding = System::Windows::Forms::Padding(3);
this->tabPage2->Size = System::Drawing::Size(298, 241);
this->tabPage2->TabIndex = 1;
this->tabPage2->Text = L"选课";
this->tabPage2->UseVisualStyleBackColor = true;
//
// button6
//
this->button6->Location = System::Drawing::Point(191, 198);
this->button6->Name = L"button6";
this->button6->Size = System::Drawing::Size(75, 23);
this->button6->TabIndex = 5;
this->button6->Text = L"确定";
this->button6->UseVisualStyleBackColor = true;
this->button6->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
//
// button5
//
this->button5->Location = System::Drawing::Point(30, 198);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(75, 23);
this->button5->TabIndex = 4;
this->button5->Text = L"上一步";
this->button5->UseVisualStyleBackColor = true;
this->button5->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
//
// button4
//
this->button4->Location = System::Drawing::Point(130, 109);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(38, 23);
this->button4->TabIndex = 3;
this->button4->Text = L"<<";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(130, 50);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(38, 23);
this->button3->TabIndex = 2;
this->button3->Text = L">>";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// listBox2
//
this->listBox2->FormattingEnabled = true;
this->listBox2->ItemHeight = 12;
this->listBox2->Location = System::Drawing::Point(174, 16);
this->listBox2->Name = L"listBox2";
this->listBox2->Size = System::Drawing::Size(107, 160);
this->listBox2->TabIndex = 1;
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->ItemHeight = 12;
this->listBox1->Location = System::Drawing::Point(17, 16);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(107, 160);
this->listBox1->TabIndex = 0;
this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox1_SelectedIndexChanged);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(330, 291);
this->Controls->Add(this->tabControl1);
this->Name = L"Form1";
this->Text = L"选课";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->tabControl1->ResumeLayout(false);
this->tabPage1->ResumeLayout(false);
this->tabPage1->PerformLayout();
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->tabPage2->ResumeLayout(false);
this->ResumeLayout(false);
}
private:String^ item;
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
tabControl1->SelectedTab=tabPage2;
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if(listBox2->FindString(listBox1->SelectedItem->ToString())>=0)
MessageBox::Show("您已经选择了该课","提示");
else
{
listBox2->Items->Add(listBox1->SelectedItem);
item+=listBox1->SelectedItem->ToString()+"\n";
}
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
listBox2->Items->Remove(listBox2->SelectedItem);
}
private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
tabControl1->SelectedTab=tabPage1;
}
private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
array<System::String^>^ Array1={"数据库","数据结构","离散数学","C++程序设计"};
array<System::String^>^ Array2={"信息系统","电路","电子工程","程序设计语言","移动通信"};
array<System::String^>^ Array3={"中国史","古代历史","世界发展史","中国近代史","历史概论"};
array<System::String^>^ Array4={"法律基础","商务法","逻辑学"};
if(comboBox1->Text=="软件学院")
{
listBox1->Items->Clear();
for(int i=0;i<Array1->Length;i++)
listBox1->Items->Add(Array1[i]);
}
else if(comboBox1->Text=="电子系")
{
listBox1->Items->Clear();
for(int i=0;i<Array2->Length;i++)
listBox1->Items->Add(Array2[i]);
}
else if(comboBox1->Text=="历史系")
{
listBox1->Items->Clear();
for(int i=0;i<Array3->Length;i++)
listBox1->Items->Add(Array3[i]);
}
else if(comboBox1->Text=="法学院")
{
listBox1->Items->Clear();
for(int i=0;i<Array4->Length;i++)
listBox1->Items->Add(Array4[i]);
}
else
{
listBox1->Items->Clear();
listBox1->Items->Add("暂时不开课");
}
}
private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {
选课结果^ f=gcnew 选课结果(textBox1->Text,radioButton1->Checked,comboBox1->Text,item);
//f->CallMessage+=gcnew EventHandler(this,&course::Form1::ShowMessage);
this->Hide();
f->ShowDialog();
}
/*public: void ShowMessage(System::Object^ sender, System::EventArgs^ e)
{
选课结果^ F=gcnew 选课结果();
F->label5->Text=textBox1->Text;
MessageBox::Show(F->label5->Text);
}*/
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -