diff --git a/Course.Designer.cs b/Course.Designer.cs index 049e0ba..dcb4e52 100644 --- a/Course.Designer.cs +++ b/Course.Designer.cs @@ -35,31 +35,38 @@ private void InitializeComponent() this.button4 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.domainUpDown1 = new System.Windows.Forms.DomainUpDown(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // button1 // - this.button1.Location = new System.Drawing.Point(536, 62); + this.button1.Location = new System.Drawing.Point(689, 73); + this.button1.Margin = new System.Windows.Forms.Padding(4); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(242, 31); + this.button1.Size = new System.Drawing.Size(311, 36); this.button1.TabIndex = 0; this.button1.Text = "通知"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // - this.button2.Location = new System.Drawing.Point(536, 115); + this.button2.Location = new System.Drawing.Point(689, 135); + this.button2.Margin = new System.Windows.Forms.Padding(4); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(242, 31); + this.button2.Size = new System.Drawing.Size(311, 36); this.button2.TabIndex = 0; this.button2.Text = "讨论"; this.button2.UseVisualStyleBackColor = true; // // button3 // - this.button3.Location = new System.Drawing.Point(536, 166); + this.button3.Location = new System.Drawing.Point(689, 195); + this.button3.Margin = new System.Windows.Forms.Padding(4); this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(242, 31); + this.button3.Size = new System.Drawing.Size(311, 36); this.button3.TabIndex = 0; this.button3.Text = "作业"; this.button3.UseVisualStyleBackColor = true; @@ -67,9 +74,10 @@ private void InitializeComponent() // // button4 // - this.button4.Location = new System.Drawing.Point(536, 221); + this.button4.Location = new System.Drawing.Point(689, 260); + this.button4.Margin = new System.Windows.Forms.Padding(4); this.button4.Name = "button4"; - this.button4.Size = new System.Drawing.Size(242, 31); + this.button4.Size = new System.Drawing.Size(311, 36); this.button4.TabIndex = 0; this.button4.Text = "考试"; this.button4.UseVisualStyleBackColor = true; @@ -78,33 +86,56 @@ private void InitializeComponent() // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label1.Location = new System.Drawing.Point(26, 15); + this.label1.Location = new System.Drawing.Point(33, 18); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(75, 28); + this.label1.Size = new System.Drawing.Size(96, 35); this.label1.TabIndex = 1; this.label1.Text = "课程名"; // // panel1 // - this.panel1.Location = new System.Drawing.Point(35, 62); + this.panel1.Controls.Add(this.domainUpDown1); + this.panel1.Location = new System.Drawing.Point(45, 87); + this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(454, 376); + this.panel1.Size = new System.Drawing.Size(584, 428); this.panel1.TabIndex = 2; // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(45, 63); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(54, 20); + this.label2.TabIndex = 0; + this.label2.Text = "目录:"; + // + // domainUpDown1 + // + this.domainUpDown1.Location = new System.Drawing.Point(33, 48); + this.domainUpDown1.Name = "domainUpDown1"; + this.domainUpDown1.Size = new System.Drawing.Size(149, 27); + this.domainUpDown1.TabIndex = 0; + this.domainUpDown1.Text = "domainUpDown1"; + // // Course // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(846, 450); + this.ClientSize = new System.Drawing.Size(1088, 529); + this.Controls.Add(this.label2); this.Controls.Add(this.panel1); this.Controls.Add(this.label1); this.Controls.Add(this.button4); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); + this.Margin = new System.Windows.Forms.Padding(4); this.Name = "Course"; this.Text = "Course"; this.Load += new System.EventHandler(this.Course_Load); + this.panel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -118,5 +149,7 @@ private void InitializeComponent() private System.Windows.Forms.Button button4; private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.DomainUpDown domainUpDown1; } } \ No newline at end of file diff --git a/Course.cs b/Course.cs index a862807..66fefcf 100644 --- a/Course.cs +++ b/Course.cs @@ -14,6 +14,11 @@ public Course() { InitializeComponent(); } + public Course(String Cname) + { + InitializeComponent(); + label1.Text = "课程:"+Cname; + } private void Course_Load(object sender, EventArgs e) { @@ -24,5 +29,11 @@ private void button3_Click(object sender, EventArgs e) { } + + private void button1_Click(object sender, EventArgs e) + { + DatabaseDesign.Notice nc= new DatabaseDesign.Notice(); + nc.Show(); + } } } diff --git a/CreatCourse.Designer.cs b/CreatCourse.Designer.cs new file mode 100644 index 0000000..cae2ff1 --- /dev/null +++ b/CreatCourse.Designer.cs @@ -0,0 +1,142 @@ +namespace DatabaseDesign +{ + partial class CreatCourse + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(176, 113); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(69, 20); + this.label1.TabIndex = 0; + this.label1.Text = "课程名称"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(176, 196); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(39, 20); + this.label2.TabIndex = 1; + this.label2.Text = "教师"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(176, 289); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(39, 20); + this.label3.TabIndex = 2; + this.label3.Text = "说明"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(307, 113); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(322, 27); + this.textBox1.TabIndex = 3; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(307, 286); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(322, 27); + this.textBox2.TabIndex = 3; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(307, 196); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(322, 27); + this.textBox3.TabIndex = 4; + this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(444, 363); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(160, 44); + this.button1.TabIndex = 5; + this.button1.Text = "下一步"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(247, 365); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(143, 42); + this.button2.TabIndex = 6; + this.button2.Text = "返回"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // CreatCourse + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "CreatCourse"; + this.Text = "CreatCourse"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} \ No newline at end of file diff --git a/CreatCourse.cs b/CreatCourse.cs new file mode 100644 index 0000000..2b5853c --- /dev/null +++ b/CreatCourse.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace DatabaseDesign +{ + public partial class CreatCourse : Form + { + String CourseName = ""; + String CourseTeacher = ""; + String CourseExplain = ""; + public CreatCourse() + { + InitializeComponent(); + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + CourseName = textBox1.Text; + } + + private void textBox3_TextChanged(object sender, EventArgs e) + { + //Get CourseTeacher; + textBox3.Text = CourseTeacher ; + } + + private void button1_Click(object sender, EventArgs e) + { + if (CourseName != "") + { + //update courseinfo;3strings + WinFormsApp1.Course css = new WinFormsApp1.Course(CourseName); + css.Show(); + Close(); + } + else + { + MessageBox.Show("课程名为空"); + } + } + + private void button2_Click(object sender, EventArgs e) + { + Close(); + } + } +} diff --git a/CreatCourse.resx b/CreatCourse.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/CreatCourse.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DatabaseDesign.csproj b/DatabaseDesign.csproj index 130a486..9b6e03a 100644 --- a/DatabaseDesign.csproj +++ b/DatabaseDesign.csproj @@ -6,4 +6,8 @@ true + + + + \ No newline at end of file diff --git a/Form1.Designer.cs b/Form1.Designer.cs new file mode 100644 index 0000000..44d2cf2 --- /dev/null +++ b/Form1.Designer.cs @@ -0,0 +1,87 @@ +namespace DatabaseDesign +{ + partial class Notice + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft YaHei UI", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label1.Location = new System.Drawing.Point(58, 29); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(114, 32); + this.label1.TabIndex = 0; + this.label1.Text = "我的通知"; + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 20; + this.listBox1.Location = new System.Drawing.Point(58, 81); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(619, 304); + this.listBox1.TabIndex = 1; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(566, 32); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(93, 29); + this.button1.TabIndex = 2; + this.button1.Text = "新建"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Notice + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.button1); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.label1); + this.Name = "Notice"; + this.Text = "Notice"; + this.Load += new System.EventHandler(this.Notice_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/Form1.cs b/Form1.cs new file mode 100644 index 0000000..e2ef534 --- /dev/null +++ b/Form1.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace DatabaseDesign +{ + public partial class Notice : Form + { + public Notice() + { + InitializeComponent(); + } + + private void Notice_Load(object sender, EventArgs e) + { + listBox1.Text = ""; + } + + private void button1_Click(object sender, EventArgs e) + { + + listBox1.Text = ""; + } + } +} diff --git a/Form1.resx b/Form1.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/StuUI.Designer.cs b/StuUI.Designer.cs index ca58694..4d3d5a0 100644 --- a/StuUI.Designer.cs +++ b/StuUI.Designer.cs @@ -35,13 +35,17 @@ private void InitializeComponent() this.panel2 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.button3 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.panel4 = new System.Windows.Forms.Panel(); this.SuspendLayout(); // // button1 // - this.button1.Location = new System.Drawing.Point(24, 59); + this.button1.Location = new System.Drawing.Point(31, 69); + this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(107, 41); + this.button1.Size = new System.Drawing.Size(138, 48); this.button1.TabIndex = 0; this.button1.Text = "教授的课程"; this.button1.UseVisualStyleBackColor = true; @@ -49,9 +53,10 @@ private void InitializeComponent() // // button2 // - this.button2.Location = new System.Drawing.Point(24, 115); + this.button2.Location = new System.Drawing.Point(31, 135); + this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(107, 41); + this.button2.Size = new System.Drawing.Size(138, 48); this.button2.TabIndex = 0; this.button2.Text = "个人资料"; this.button2.UseVisualStyleBackColor = true; @@ -59,48 +64,87 @@ private void InitializeComponent() // // panel1 // - this.panel1.Location = new System.Drawing.Point(152, 59); + this.panel1.Location = new System.Drawing.Point(195, 69); + this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(136, 145); + this.panel1.Size = new System.Drawing.Size(175, 171); this.panel1.TabIndex = 1; + this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // panel2 // - this.panel2.Location = new System.Drawing.Point(325, 59); + this.panel2.Location = new System.Drawing.Point(418, 69); + this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(136, 145); + this.panel2.Size = new System.Drawing.Size(175, 171); this.panel2.TabIndex = 1; // // panel3 // - this.panel3.Location = new System.Drawing.Point(493, 59); + this.panel3.Location = new System.Drawing.Point(634, 69); + this.panel3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(136, 145); + this.panel3.Size = new System.Drawing.Size(175, 171); this.panel3.TabIndex = 1; // // button3 // - this.button3.Location = new System.Drawing.Point(687, 13); + this.button3.Location = new System.Drawing.Point(879, 33); + this.button3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.Size = new System.Drawing.Size(96, 27); this.button3.TabIndex = 2; this.button3.Text = "创建课程"; this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(216, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(69, 20); + this.label1.TabIndex = 3; + this.label1.Text = "我学的课"; + this.label1.Click += new System.EventHandler(this.label1_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(317, 36); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(69, 20); + this.label2.TabIndex = 4; + this.label2.Text = "我教的课"; + // + // panel4 + // + this.panel4.Location = new System.Drawing.Point(195, 269); + this.panel4.Margin = new System.Windows.Forms.Padding(4); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(175, 164); + this.panel4.TabIndex = 1; + this.panel4.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // // StuUI // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(1062, 545); + this.Controls.Add(this.panel4); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); this.Controls.Add(this.button3); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Controls.Add(this.button2); this.Controls.Add(this.button1); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "StuUI"; this.Text = "StuUI"; this.ResumeLayout(false); + this.PerformLayout(); } @@ -112,5 +156,8 @@ private void InitializeComponent() private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Button button3; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Panel panel4; } } \ No newline at end of file diff --git a/StuUI.cs b/StuUI.cs index 47332b5..1b357b6 100644 --- a/StuUI.cs +++ b/StuUI.cs @@ -19,5 +19,21 @@ private void button1_Click(object sender, EventArgs e) { } + + private void label1_Click(object sender, EventArgs e) + { + + } + + private void panel1_Paint(object sender, PaintEventArgs e) + { + + } + + private void button3_Click(object sender, EventArgs e) + { + DatabaseDesign.CreatCourse crtC = new DatabaseDesign.CreatCourse(); + crtC.Show(); + } } } diff --git a/TesUI.Designer.cs b/TesUI.Designer.cs index 458a1a2..03ac289 100644 --- a/TesUI.Designer.cs +++ b/TesUI.Designer.cs @@ -29,102 +29,12 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.button3 = new System.Windows.Forms.Button(); - this.panel1 = new System.Windows.Forms.Panel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.panel3 = new System.Windows.Forms.Panel(); - this.panel4 = new System.Windows.Forms.Panel(); - this.panel5 = new System.Windows.Forms.Panel(); - this.panel6 = new System.Windows.Forms.Panel(); this.SuspendLayout(); // - // button1 - // - this.button1.Location = new System.Drawing.Point(25, 69); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 0; - this.button1.Text = "课程"; - this.button1.UseVisualStyleBackColor = true; - // - // button2 - // - this.button2.Location = new System.Drawing.Point(25, 117); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(75, 23); - this.button2.TabIndex = 0; - this.button2.Text = "个人资料"; - this.button2.UseVisualStyleBackColor = true; - // - // button3 - // - this.button3.Location = new System.Drawing.Point(680, 12); - this.button3.Name = "button3"; - this.button3.Size = new System.Drawing.Size(97, 23); - this.button3.TabIndex = 0; - this.button3.Text = "添加课程"; - this.button3.UseVisualStyleBackColor = true; - // - // panel1 - // - this.panel1.Location = new System.Drawing.Point(133, 43); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(146, 143); - this.panel1.TabIndex = 1; - // - // panel2 - // - this.panel2.Location = new System.Drawing.Point(310, 43); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(146, 143); - this.panel2.TabIndex = 1; - // - // panel3 - // - this.panel3.Location = new System.Drawing.Point(508, 43); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(146, 143); - this.panel3.TabIndex = 1; - // - // panel4 - // - this.panel4.Location = new System.Drawing.Point(133, 204); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(146, 143); - this.panel4.TabIndex = 1; - // - // panel5 - // - this.panel5.Location = new System.Drawing.Point(310, 204); - this.panel5.Name = "panel5"; - this.panel5.Size = new System.Drawing.Size(146, 143); - this.panel5.TabIndex = 1; - // - // panel6 - // - this.panel6.Location = new System.Drawing.Point(508, 204); - this.panel6.Name = "panel6"; - this.panel6.Size = new System.Drawing.Size(146, 143); - this.panel6.TabIndex = 1; - // // TesUI // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.panel6); - this.Controls.Add(this.panel5); - this.Controls.Add(this.panel4); - this.Controls.Add(this.panel3); - this.Controls.Add(this.panel2); - this.Controls.Add(this.panel1); - this.Controls.Add(this.button3); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); + this.ClientSize = new System.Drawing.Size(390, 288); this.Name = "TesUI"; - this.Text = "TesUI"; this.ResumeLayout(false); } @@ -140,5 +50,7 @@ private void InitializeComponent() private System.Windows.Forms.Panel panel4; private System.Windows.Forms.Panel panel5; private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/login.Designer.cs b/login.Designer.cs index 66a1fcd..40bc11c 100644 --- a/login.Designer.cs +++ b/login.Designer.cs @@ -1,4 +1,57 @@ - +/* +namespace WinFormsApp1 +{ + partial class login + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // login + // + this.ClientSize = new System.Drawing.Size(845, 446); + this.Name = "login"; + this.Load += new System.EventHandler(this.login_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} +*/ namespace WinFormsApp1 { partial class login @@ -40,24 +93,27 @@ private void InitializeComponent() // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(201, 146); + this.textBox1.Location = new System.Drawing.Point(258, 172); + this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(307, 23); + this.textBox1.Size = new System.Drawing.Size(394, 27); this.textBox1.TabIndex = 0; // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(201, 225); + this.textBox2.Location = new System.Drawing.Point(258, 265); + this.textBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(307, 23); + this.textBox2.Size = new System.Drawing.Size(394, 27); this.textBox2.TabIndex = 1; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(136, 146); + this.label1.Location = new System.Drawing.Point(175, 172); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(32, 17); + this.label1.Size = new System.Drawing.Size(39, 20); this.label1.TabIndex = 2; this.label1.Text = "账号"; this.label1.Click += new System.EventHandler(this.label1_Click); @@ -65,9 +121,10 @@ private void InitializeComponent() // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(136, 230); + this.label2.Location = new System.Drawing.Point(175, 271); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(32, 17); + this.label2.Size = new System.Drawing.Size(39, 20); this.label2.TabIndex = 3; this.label2.Text = "密码"; // @@ -75,17 +132,19 @@ private void InitializeComponent() // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label3.Location = new System.Drawing.Point(327, 83); + this.label3.Location = new System.Drawing.Point(420, 98); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(54, 28); + this.label3.Size = new System.Drawing.Size(69, 35); this.label3.TabIndex = 4; this.label3.Text = "登录"; // // button1 // - this.button1.Location = new System.Drawing.Point(201, 303); + this.button1.Location = new System.Drawing.Point(258, 356); + this.button1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(81, 35); + this.button1.Size = new System.Drawing.Size(104, 41); this.button1.TabIndex = 5; this.button1.Text = "登录"; this.button1.UseVisualStyleBackColor = true; @@ -93,19 +152,20 @@ private void InitializeComponent() // // button2 // - this.button2.Location = new System.Drawing.Point(427, 303); + this.button2.Location = new System.Drawing.Point(549, 356); + this.button2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(81, 35); + this.button2.Size = new System.Drawing.Size(104, 41); this.button2.TabIndex = 5; this.button2.Text = "注册"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // - // Form1 + // login // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(930, 528); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.label3); @@ -113,8 +173,10 @@ private void InitializeComponent() this.Controls.Add(this.label1); this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox1); - this.Name = "Form1"; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Name = "login"; this.Text = "Form1"; + this.Load += new System.EventHandler(this.login_Load); this.ResumeLayout(false); this.PerformLayout(); diff --git a/login.cs b/login.cs index d012881..38bdcf7 100644 --- a/login.cs +++ b/login.cs @@ -2,12 +2,13 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; - +using System.Data.SqlClient; namespace WinFormsApp1 { public partial class login : Form @@ -15,16 +16,51 @@ public partial class login : Form public login() { InitializeComponent(); + //string connectString = "Data Source=121.196.159.49;Initial Catalog=Student;Integrated Security=True"; + } private void label1_Click(object sender, EventArgs e) { } - + private bool CheckInfo(String user, String pword) + { + //datebase comparing + return true; + } private void button1_Click(object sender, EventArgs e) { - + string ConStr = "server=121.196.159.49;database=Course;uid=sa;pwd=02200059Yl"; + SqlConnection sqlCnt = new SqlConnection(ConStr); + sqlCnt.Open(); + /* + string sql = "select count(*) from USER_ where Identity_='老师'"; + SqlCommand com = new SqlCommand(sql, sqlCnt); + int a = (int)com.ExecuteScalar(); + if (a != 0) + { + label1.Text = "success"+a; + } + else + { + label1.Text = "no"; + }*/ + String suser = textBox1.Text; + String spassword = textBox2.Text; + string sql = "select count(*) from USER_ where Identity_='老师'"; + SqlCommand com = new SqlCommand(sql, sqlCnt); + int a = (int)com.ExecuteScalar(); + if (CheckInfo(suser, spassword)) + { + MessageBox.Show("登录成功"); + StuUI stu1 = new StuUI(); + stu1.Show(); + } + else + { + MessageBox.Show("账号或者密码不正确"); + } } private void button2_Click(object sender, EventArgs e) @@ -32,5 +68,10 @@ private void button2_Click(object sender, EventArgs e) register reg = new register(); reg.Show(); } + + private void login_Load(object sender, EventArgs e) + { + + } } -} +} \ No newline at end of file diff --git a/register.Designer.cs b/register.Designer.cs index 08fdc4c..43f6962 100644 --- a/register.Designer.cs +++ b/register.Designer.cs @@ -43,72 +43,84 @@ private void InitializeComponent() this.panel1 = new System.Windows.Forms.Panel(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.label7 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(173, 86); + this.label1.Location = new System.Drawing.Point(222, 101); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(32, 17); + this.label1.Size = new System.Drawing.Size(39, 20); this.label1.TabIndex = 0; this.label1.Text = "账号"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(173, 141); + this.label2.Location = new System.Drawing.Point(222, 166); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(32, 17); + this.label2.Size = new System.Drawing.Size(39, 20); this.label2.TabIndex = 1; this.label2.Text = "密码"; // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(223, 86); + this.textBox1.Location = new System.Drawing.Point(287, 101); + this.textBox1.Margin = new System.Windows.Forms.Padding(4); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(327, 23); + this.textBox1.Size = new System.Drawing.Size(419, 27); this.textBox1.TabIndex = 2; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); // // textBox2 // - this.textBox2.Location = new System.Drawing.Point(223, 141); + this.textBox2.Location = new System.Drawing.Point(287, 166); + this.textBox2.Margin = new System.Windows.Forms.Padding(4); this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(327, 23); + this.textBox2.Size = new System.Drawing.Size(419, 27); this.textBox2.TabIndex = 2; + this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged); // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label3.Location = new System.Drawing.Point(353, 24); + this.label3.Location = new System.Drawing.Point(454, 28); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(54, 28); + this.label3.Size = new System.Drawing.Size(69, 35); this.label3.TabIndex = 0; this.label3.Text = "注册"; // // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(149, 206); + this.label4.Location = new System.Drawing.Point(192, 242); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(56, 17); + this.label4.Size = new System.Drawing.Size(69, 20); this.label4.TabIndex = 1; this.label4.Text = "确认密码"; // // textBox3 // - this.textBox3.Location = new System.Drawing.Point(223, 200); + this.textBox3.Location = new System.Drawing.Point(287, 235); + this.textBox3.Margin = new System.Windows.Forms.Padding(4); this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(327, 23); + this.textBox3.Size = new System.Drawing.Size(419, 27); this.textBox3.TabIndex = 2; + this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged); // // button1 // - this.button1.Location = new System.Drawing.Point(291, 371); + this.button1.Location = new System.Drawing.Point(374, 436); + this.button1.Margin = new System.Windows.Forms.Padding(4); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(188, 30); + this.button1.Size = new System.Drawing.Size(242, 35); this.button1.TabIndex = 3; this.button1.Text = "注册"; this.button1.UseVisualStyleBackColor = true; @@ -117,42 +129,47 @@ private void InitializeComponent() // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(172, 253); + this.label5.Location = new System.Drawing.Point(221, 298); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(32, 17); + this.label5.Size = new System.Drawing.Size(39, 20); this.label5.TabIndex = 4; this.label5.Text = "身份"; // // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(161, 296); + this.label6.Location = new System.Drawing.Point(207, 348); + this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(0, 17); + this.label6.Size = new System.Drawing.Size(0, 20); this.label6.TabIndex = 6; // // textBox4 // - this.textBox4.Location = new System.Drawing.Point(223, 296); + this.textBox4.Location = new System.Drawing.Point(287, 348); + this.textBox4.Margin = new System.Windows.Forms.Padding(4); this.textBox4.Name = "textBox4"; - this.textBox4.Size = new System.Drawing.Size(327, 23); + this.textBox4.Size = new System.Drawing.Size(419, 27); this.textBox4.TabIndex = 7; // // panel1 // this.panel1.Controls.Add(this.radioButton2); this.panel1.Controls.Add(this.radioButton1); - this.panel1.Location = new System.Drawing.Point(223, 243); + this.panel1.Location = new System.Drawing.Point(287, 286); + this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(327, 37); + this.panel1.Size = new System.Drawing.Size(420, 44); this.panel1.TabIndex = 8; // // radioButton2 // this.radioButton2.AutoSize = true; - this.radioButton2.Location = new System.Drawing.Point(154, 8); + this.radioButton2.Location = new System.Drawing.Point(198, 9); + this.radioButton2.Margin = new System.Windows.Forms.Padding(4); this.radioButton2.Name = "radioButton2"; - this.radioButton2.Size = new System.Drawing.Size(50, 21); + this.radioButton2.Size = new System.Drawing.Size(57, 24); this.radioButton2.TabIndex = 0; this.radioButton2.TabStop = true; this.radioButton2.Text = "学生"; @@ -162,20 +179,30 @@ private void InitializeComponent() // radioButton1 // this.radioButton1.AutoSize = true; - this.radioButton1.Location = new System.Drawing.Point(18, 10); + this.radioButton1.Location = new System.Drawing.Point(23, 12); + this.radioButton1.Margin = new System.Windows.Forms.Padding(4); this.radioButton1.Name = "radioButton1"; - this.radioButton1.Size = new System.Drawing.Size(50, 21); + this.radioButton1.Size = new System.Drawing.Size(57, 24); this.radioButton1.TabIndex = 0; this.radioButton1.TabStop = true; this.radioButton1.Text = "老师"; this.radioButton1.UseVisualStyleBackColor = true; this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(727, 238); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(0, 20); + this.label7.TabIndex = 9; + // // register // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(1029, 529); + this.Controls.Add(this.label7); this.Controls.Add(this.panel1); this.Controls.Add(this.textBox4); this.Controls.Add(this.label6); @@ -188,6 +215,7 @@ private void InitializeComponent() this.Controls.Add(this.label2); this.Controls.Add(this.label3); this.Controls.Add(this.label1); + this.Margin = new System.Windows.Forms.Padding(4); this.Name = "register"; this.Text = "Form2"; this.Load += new System.EventHandler(this.register_Load); @@ -214,5 +242,6 @@ private void InitializeComponent() private System.Windows.Forms.Panel panel1; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.Label label7; } } \ No newline at end of file diff --git a/register.cs b/register.cs index 0edc668..f281494 100644 --- a/register.cs +++ b/register.cs @@ -10,6 +10,9 @@ namespace WinFormsApp1 { public partial class register : Form { + int F1=0,F2=0,F3=0,F4=0; + String regName = ""; + String regPassword = ""; public register() { InitializeComponent(); @@ -17,16 +20,33 @@ public register() private void register_Load(object sender, EventArgs e) { - + //从数据库中读取生成身份编号 } private void button1_Click(object sender, EventArgs e) { - Close(); + if (F3 == -1) + { + MessageBox.Show("两次密码输入不一致"); + } + else + { + if (F1 == 1 && F2 == 1 && F3 == 1 && F4 == 1) + { + MessageBox.Show("注册成功"); + //上传数据库 + Close(); + } + else + { + MessageBox.Show("存在未填写字段"); + } + } } private void radioButton1_CheckedChanged(object sender, EventArgs e) { + F4 = 1; if (radioButton1.Checked) { label6.Text = "教师号"; @@ -35,10 +55,36 @@ private void radioButton1_CheckedChanged(object sender, EventArgs e) private void radioButton2_CheckedChanged(object sender, EventArgs e) { + F4 = 1; if (radioButton2.Checked) { label6.Text = "学号"; } } + + private void textBox2_TextChanged(object sender, EventArgs e) + { + regPassword = textBox2.Text; + F2 = 1; + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + //检测用户名是否重复 + regName = textBox1.Text; + F1 = 1; + } + + private void textBox3_TextChanged(object sender, EventArgs e) + { + if (String.Equals(regPassword, textBox3.Text)) + { + F3 = 1; + } + else + { + F3 = -1; + } + } } }