form1.h

来自「Visual_C++.NET实用编程百例」· C头文件 代码 · 共 341 行

H
341
字号
#pragma once


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 __gc class Form1 : public System::Windows::Forms::Form
	{	
	public:
		Form1(void)
		{
			InitializeComponent();
		}
  
	protected:
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::TabControl *  tabControl1;
	private: System::Windows::Forms::TabPage *  tabPage1;
	private: System::Windows::Forms::TabPage *  tabPage2;
	private: System::Windows::Forms::Label *  label1;
	private: System::Windows::Forms::TextBox *  textBox1;
	private: System::Windows::Forms::RadioButton *  radioButton1;
	private: System::Windows::Forms::RadioButton *  radioButton2;
	private: System::Windows::Forms::GroupBox *  groupBox1;
	private: System::Windows::Forms::Button *  button1;


	private: System::Windows::Forms::ListBox *  listBox1;
	private: System::Windows::Forms::ListBox *  listBox2;
	private: System::Windows::Forms::Button *  button4;
	private: System::Windows::Forms::Button *  button3;
	private: System::Windows::Forms::Button *  button6;
	private: System::Windows::Forms::Button *  button5;
	private: System::Windows::Forms::Button *  button2;
	private: System::Windows::Forms::Label *  label2;
	private: System::Windows::Forms::ComboBox *  comboBox1;







	private:
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		System::ComponentModel::Container * components;

		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		void InitializeComponent(void)
		{
			this->tabControl1 = new System::Windows::Forms::TabControl();
			this->tabPage1 = new System::Windows::Forms::TabPage();
			this->label2 = new System::Windows::Forms::Label();
			this->comboBox1 = new System::Windows::Forms::ComboBox();
			this->button2 = new System::Windows::Forms::Button();
			this->button1 = new System::Windows::Forms::Button();
			this->groupBox1 = new System::Windows::Forms::GroupBox();
			this->radioButton1 = new System::Windows::Forms::RadioButton();
			this->radioButton2 = new System::Windows::Forms::RadioButton();
			this->textBox1 = new System::Windows::Forms::TextBox();
			this->label1 = new System::Windows::Forms::Label();
			this->tabPage2 = new System::Windows::Forms::TabPage();
			this->button4 = new System::Windows::Forms::Button();
			this->button3 = new System::Windows::Forms::Button();
			this->button6 = new System::Windows::Forms::Button();
			this->button5 = new System::Windows::Forms::Button();
			this->listBox2 = new System::Windows::Forms::ListBox();
			this->listBox1 = new 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(16, 16);
			this->tabControl1->Name = S"tabControl1";
			this->tabControl1->SelectedIndex = 0;
			this->tabControl1->Size = System::Drawing::Size(288, 224);
			this->tabControl1->TabIndex = 0;
			// 
			// tabPage1
			// 
			this->tabPage1->Controls->Add(this->label2);
			this->tabPage1->Controls->Add(this->comboBox1);
			this->tabPage1->Controls->Add(this->button2);
			this->tabPage1->Controls->Add(this->button1);
			this->tabPage1->Controls->Add(this->groupBox1);
			this->tabPage1->Controls->Add(this->textBox1);
			this->tabPage1->Controls->Add(this->label1);
			this->tabPage1->Location = System::Drawing::Point(4, 21);
			this->tabPage1->Name = S"tabPage1";
			this->tabPage1->Size = System::Drawing::Size(280, 199);
			this->tabPage1->TabIndex = 0;
			this->tabPage1->Text = S"登记";
			// 
			// label2
			// 
			this->label2->Location = System::Drawing::Point(56, 128);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(40, 16);
			this->label2->TabIndex = 9;
			this->label2->Text = S"院系";
			// 
			// comboBox1
			// 
			System::Object* __mcTemp__1[] = new System::Object*[4];
			__mcTemp__1[0] = S"软件学院";
			__mcTemp__1[1] = S"电子系";
			__mcTemp__1[2] = S"历史系";
			__mcTemp__1[3] = S"法学院";
			this->comboBox1->Items->AddRange(__mcTemp__1);
			this->comboBox1->Location = System::Drawing::Point(112, 128);
			this->comboBox1->Name = S"comboBox1";
			this->comboBox1->Size = System::Drawing::Size(104, 20);
			this->comboBox1->TabIndex = 8;
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(152, 160);
			this->button2->Name = S"button2";
			this->button2->TabIndex = 7;
			this->button2->Text = S"退出";
			this->button2->Click += new System::EventHandler(this, button2_Click);
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(48, 160);
			this->button1->Name = S"button1";
			this->button1->Size = System::Drawing::Size(64, 23);
			this->button1->TabIndex = 6;
			this->button1->Text = S"选课";
			this->button1->Click += new System::EventHandler(this, button1_Click);
			// 
			// groupBox1
			// 
			this->groupBox1->Controls->Add(this->radioButton1);
			this->groupBox1->Controls->Add(this->radioButton2);
			this->groupBox1->Location = System::Drawing::Point(56, 48);
			this->groupBox1->Name = S"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(160, 64);
			this->groupBox1->TabIndex = 5;
			this->groupBox1->TabStop = false;
			this->groupBox1->Text = S"性别";
			// 
			// radioButton1
			// 
			this->radioButton1->Checked = true;
			this->radioButton1->Location = System::Drawing::Point(24, 32);
			this->radioButton1->Name = S"radioButton1";
			this->radioButton1->Size = System::Drawing::Size(40, 16);
			this->radioButton1->TabIndex = 3;
			this->radioButton1->TabStop = true;
			this->radioButton1->Text = S"男";
			// 
			// radioButton2
			// 
			this->radioButton2->Location = System::Drawing::Point(96, 32);
			this->radioButton2->Name = S"radioButton2";
			this->radioButton2->Size = System::Drawing::Size(40, 16);
			this->radioButton2->TabIndex = 4;
			this->radioButton2->Text = S"女";
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(112, 16);
			this->textBox1->Name = S"textBox1";
			this->textBox1->TabIndex = 2;
			this->textBox1->Text = S"";
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(56, 16);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(40, 16);
			this->label1->TabIndex = 0;
			this->label1->Text = S"姓名";
			// 
			// tabPage2
			// 
			this->tabPage2->Controls->Add(this->button4);
			this->tabPage2->Controls->Add(this->button3);
			this->tabPage2->Controls->Add(this->button6);
			this->tabPage2->Controls->Add(this->button5);
			this->tabPage2->Controls->Add(this->listBox2);
			this->tabPage2->Controls->Add(this->listBox1);
			this->tabPage2->Location = System::Drawing::Point(4, 21);
			this->tabPage2->Name = S"tabPage2";
			this->tabPage2->Size = System::Drawing::Size(280, 199);
			this->tabPage2->TabIndex = 1;
			this->tabPage2->Text = S"选课";
			// 
			// button4
			// 
			this->button4->Location = System::Drawing::Point(120, 88);
			this->button4->Name = S"button4";
			this->button4->Size = System::Drawing::Size(32, 24);
			this->button4->TabIndex = 7;
			this->button4->Text = S"<<";
			this->button4->Click += new System::EventHandler(this, button4_Click);
			// 
			// button3
			// 
			this->button3->Location = System::Drawing::Point(120, 40);
			this->button3->Name = S"button3";
			this->button3->Size = System::Drawing::Size(32, 24);
			this->button3->TabIndex = 6;
			this->button3->Text = S">>";
			this->button3->Click += new System::EventHandler(this, button3_Click);
			// 
			// button6
			// 
			this->button6->Location = System::Drawing::Point(144, 160);
			this->button6->Name = S"button6";
			this->button6->TabIndex = 5;
			this->button6->Text = S"退出";
			this->button6->Click += new System::EventHandler(this, button2_Click);
			// 
			// button5
			// 
			this->button5->Location = System::Drawing::Point(40, 160);
			this->button5->Name = S"button5";
			this->button5->TabIndex = 4;
			this->button5->Text = S"上一步";
			this->button5->Click += new System::EventHandler(this, button5_Click);
			// 
			// listBox2
			// 
			this->listBox2->ItemHeight = 12;
			this->listBox2->Location = System::Drawing::Point(168, 16);
			this->listBox2->Name = S"listBox2";
			this->listBox2->Size = System::Drawing::Size(96, 124);
			this->listBox2->TabIndex = 3;
			// 
			// listBox1
			// 
			this->listBox1->ItemHeight = 12;
			System::Object* __mcTemp__2[] = new System::Object*[9];
			__mcTemp__2[0] = S"数据挖掘";
			__mcTemp__2[1] = S"计算机基础";
			__mcTemp__2[2] = S"大学英语";
			__mcTemp__2[3] = S"军事理论";
			__mcTemp__2[4] = S"Visual C++.NET";
			__mcTemp__2[5] = S"法律原理";
			__mcTemp__2[6] = S"数字电路";
			__mcTemp__2[7] = S"经济学基础";
			__mcTemp__2[8] = S"信号处理";
			this->listBox1->Items->AddRange(__mcTemp__2);
			this->listBox1->Location = System::Drawing::Point(8, 16);
			this->listBox1->Name = S"listBox1";
			this->listBox1->Size = System::Drawing::Size(96, 124);
			this->listBox1->TabIndex = 2;
			// 
			// Form1
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(320, 246);
			this->Controls->Add(this->tabControl1);
			this->Name = S"Form1";
			this->Text = S"选课";
			this->Load += new System::EventHandler(this, Form1_Load);
			this->tabControl1->ResumeLayout(false);
			this->tabPage1->ResumeLayout(false);
			this->groupBox1->ResumeLayout(false);
			this->tabPage2->ResumeLayout(false);
			this->ResumeLayout(false);

		}	
	private: System::Void Form1_Load(System::Object *  sender, System::EventArgs *  e)
			 {
			 }


private: System::Void cb_SelectChanged(System::Object *  sender, System::EventArgs *  e)
		 {
		
		 }

private: System::Void button2_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 this->Close ();
		 }

private: System::Void button5_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 tabControl1->SelectedTab = tabPage1;
		 }

private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 tabControl1->SelectedTab = tabPage2;
		 }

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);
		 }

private: System::Void button4_Click(System::Object *  sender, System::EventArgs *  e)
		 {
			 listBox2->Items->Remove(listBox2->SelectedItem);
		 }

};
}

⌨️ 快捷键说明

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