From ff17e1573bd12eac4d83c6ea5e1089150cf32cd3 Mon Sep 17 00:00:00 2001 From: Yanyixiao Date: Sat, 28 Sep 2019 13:13:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ver0.1=20=E5=86=99=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E7=82=B9=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 201731023225/SelectStudent/App.config | 6 + 201731023225/SelectStudent/Form1.Designer.cs | 99 +++++++++++++++ 201731023225/SelectStudent/Form1.cs | 52 ++++++++ 201731023225/SelectStudent/Form1.resx | 120 ++++++++++++++++++ 201731023225/SelectStudent/Program.cs | 22 ++++ .../SelectStudent/Properties/AssemblyInfo.cs | 36 ++++++ .../Properties/Resources.Designer.cs | 71 +++++++++++ .../SelectStudent/Properties/Resources.resx | 117 +++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 + .../SelectStudent/SelectStudent.csproj | 84 ++++++++++++ 201731023225/SelectStudent/SelectStudent.sln | 25 ++++ 12 files changed, 669 insertions(+) create mode 100644 201731023225/SelectStudent/App.config create mode 100644 201731023225/SelectStudent/Form1.Designer.cs create mode 100644 201731023225/SelectStudent/Form1.cs create mode 100644 201731023225/SelectStudent/Form1.resx create mode 100644 201731023225/SelectStudent/Program.cs create mode 100644 201731023225/SelectStudent/Properties/AssemblyInfo.cs create mode 100644 201731023225/SelectStudent/Properties/Resources.Designer.cs create mode 100644 201731023225/SelectStudent/Properties/Resources.resx create mode 100644 201731023225/SelectStudent/Properties/Settings.Designer.cs create mode 100644 201731023225/SelectStudent/Properties/Settings.settings create mode 100644 201731023225/SelectStudent/SelectStudent.csproj create mode 100644 201731023225/SelectStudent/SelectStudent.sln diff --git a/201731023225/SelectStudent/App.config b/201731023225/SelectStudent/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/201731023225/SelectStudent/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/201731023225/SelectStudent/Form1.Designer.cs b/201731023225/SelectStudent/Form1.Designer.cs new file mode 100644 index 0000000..c5f15ae --- /dev/null +++ b/201731023225/SelectStudent/Form1.Designer.cs @@ -0,0 +1,99 @@ +namespace SelectStudent +{ + partial class Form1 + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.Read = new System.Windows.Forms.Button(); + this.TxtName = new System.Windows.Forms.TextBox(); + this.Select = new System.Windows.Forms.Button(); + this.Name = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // Read + // + this.Read.Location = new System.Drawing.Point(289, 167); + this.Read.Name = "Read"; + this.Read.Size = new System.Drawing.Size(92, 23); + this.Read.TabIndex = 0; + this.Read.Text = "读取学生文件"; + this.Read.UseVisualStyleBackColor = true; + this.Read.Click += new System.EventHandler(this.Read_Click); + // + // TxtName + // + this.TxtName.Location = new System.Drawing.Point(12, 169); + this.TxtName.Name = "TxtName"; + this.TxtName.Size = new System.Drawing.Size(271, 21); + this.TxtName.TabIndex = 1; + // + // Select + // + this.Select.Location = new System.Drawing.Point(289, 140); + this.Select.Name = "Select"; + this.Select.Size = new System.Drawing.Size(91, 23); + this.Select.TabIndex = 0; + this.Select.Text = "随机点名"; + this.Select.UseVisualStyleBackColor = true; + this.Select.Click += new System.EventHandler(this.Select_Click); + // + // Name + // + this.Name.AutoSize = true; + this.Name.Font = new System.Drawing.Font("宋体", 80F); + this.Name.Location = new System.Drawing.Point(12, 9); + this.Name.Name = "Name"; + this.Name.Size = new System.Drawing.Size(369, 107); + this.Name.TabIndex = 2; + this.Name.Text = "label1"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(392, 208); + this.Controls.Add(this.Name); + this.Controls.Add(this.Select); + this.Controls.Add(this.TxtName); + this.Controls.Add(this.Read); + this.Name = "Form1"; + this.Text = "随机点名软件"; + this.Load += new System.EventHandler(this.Form1_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button Read; + private System.Windows.Forms.TextBox TxtName; + private System.Windows.Forms.Button Select; + private System.Windows.Forms.Label Name; + } +} + diff --git a/201731023225/SelectStudent/Form1.cs b/201731023225/SelectStudent/Form1.cs new file mode 100644 index 0000000..e3cb1e7 --- /dev/null +++ b/201731023225/SelectStudent/Form1.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; +using System.Threading; + + +namespace SelectStudent +{ + public partial class Form1 : Form + { + + string[] StudentName; + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + + public void Read_Click(object sender, EventArgs e) + { + OpenFileDialog OFD = new OpenFileDialog(); + OFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + OFD.Filter = "(*.txt)|*.txt"; + if (OFD.ShowDialog() == DialogResult.OK) + { + string strNames = OFD.FileName; + //将文件名添加到 textbox中 + TxtName.Text = strNames; + } + StudentName = File.ReadAllLines(TxtName.Text); + //读取完成txt中的姓名,txt中姓名由换行隔开 + } + + private void Select_Click(object sender, EventArgs e) + { + Random RD= new Random(); + + Name.Text= + } + } +} diff --git a/201731023225/SelectStudent/Form1.resx b/201731023225/SelectStudent/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/201731023225/SelectStudent/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/201731023225/SelectStudent/Program.cs b/201731023225/SelectStudent/Program.cs new file mode 100644 index 0000000..1980db6 --- /dev/null +++ b/201731023225/SelectStudent/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SelectStudent +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/201731023225/SelectStudent/Properties/AssemblyInfo.cs b/201731023225/SelectStudent/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7138fd1 --- /dev/null +++ b/201731023225/SelectStudent/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("SelectStudent")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SelectStudent")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("55e9b45f-1ffb-4089-adeb-9ff2b1fa4d17")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/201731023225/SelectStudent/Properties/Resources.Designer.cs b/201731023225/SelectStudent/Properties/Resources.Designer.cs new file mode 100644 index 0000000..37a7a42 --- /dev/null +++ b/201731023225/SelectStudent/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace SelectStudent.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SelectStudent.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 覆盖当前线程的 CurrentUICulture 属性 + /// 使用此强类型的资源类的资源查找。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/201731023225/SelectStudent/Properties/Resources.resx b/201731023225/SelectStudent/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/201731023225/SelectStudent/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/201731023225/SelectStudent/Properties/Settings.Designer.cs b/201731023225/SelectStudent/Properties/Settings.Designer.cs new file mode 100644 index 0000000..1bc1067 --- /dev/null +++ b/201731023225/SelectStudent/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SelectStudent.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/201731023225/SelectStudent/Properties/Settings.settings b/201731023225/SelectStudent/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/201731023225/SelectStudent/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/201731023225/SelectStudent/SelectStudent.csproj b/201731023225/SelectStudent/SelectStudent.csproj new file mode 100644 index 0000000..f82d690 --- /dev/null +++ b/201731023225/SelectStudent/SelectStudent.csproj @@ -0,0 +1,84 @@ + + + + + Debug + AnyCPU + {55E9B45F-1FFB-4089-ADEB-9FF2B1FA4D17} + WinExe + SelectStudent + SelectStudent + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/201731023225/SelectStudent/SelectStudent.sln b/201731023225/SelectStudent/SelectStudent.sln new file mode 100644 index 0000000..3645958 --- /dev/null +++ b/201731023225/SelectStudent/SelectStudent.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29306.81 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SelectStudent", "SelectStudent.csproj", "{55E9B45F-1FFB-4089-ADEB-9FF2B1FA4D17}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {55E9B45F-1FFB-4089-ADEB-9FF2B1FA4D17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55E9B45F-1FFB-4089-ADEB-9FF2B1FA4D17}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55E9B45F-1FFB-4089-ADEB-9FF2B1FA4D17}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55E9B45F-1FFB-4089-ADEB-9FF2B1FA4D17}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6C6C27BE-B84B-4C4C-9979-6165CC868D75} + EndGlobalSection +EndGlobal From 5ef523770a68f86337dfa6459fc1d9b8852d23c0 Mon Sep 17 00:00:00 2001 From: wangwancheng216 <54851392+wangwancheng216@users.noreply.github.com> Date: Mon, 30 Sep 2019 23:22:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ver1.0=20=E5=90=88=E4=BD=9C=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 201731023225/SelectStudent/Form1.Designer.cs | 43 +++++++++++--------- 201731023225/SelectStudent/Form1.cs | 12 ++++-- README.md | 8 ++++ 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/201731023225/SelectStudent/Form1.Designer.cs b/201731023225/SelectStudent/Form1.Designer.cs index c5f15ae..4dfd139 100644 --- a/201731023225/SelectStudent/Form1.Designer.cs +++ b/201731023225/SelectStudent/Form1.Designer.cs @@ -31,14 +31,15 @@ private void InitializeComponent() this.Read = new System.Windows.Forms.Button(); this.TxtName = new System.Windows.Forms.TextBox(); this.Select = new System.Windows.Forms.Button(); - this.Name = new System.Windows.Forms.Label(); + this.Student = new System.Windows.Forms.Label(); this.SuspendLayout(); // // Read // - this.Read.Location = new System.Drawing.Point(289, 167); + this.Read.Location = new System.Drawing.Point(385, 209); + this.Read.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Read.Name = "Read"; - this.Read.Size = new System.Drawing.Size(92, 23); + this.Read.Size = new System.Drawing.Size(123, 29); this.Read.TabIndex = 0; this.Read.Text = "读取学生文件"; this.Read.UseVisualStyleBackColor = true; @@ -46,40 +47,44 @@ private void InitializeComponent() // // TxtName // - this.TxtName.Location = new System.Drawing.Point(12, 169); + this.TxtName.Location = new System.Drawing.Point(16, 211); + this.TxtName.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.TxtName.Name = "TxtName"; - this.TxtName.Size = new System.Drawing.Size(271, 21); + this.TxtName.Size = new System.Drawing.Size(360, 25); this.TxtName.TabIndex = 1; // // Select // - this.Select.Location = new System.Drawing.Point(289, 140); + this.Select.Location = new System.Drawing.Point(385, 175); + this.Select.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Select.Name = "Select"; - this.Select.Size = new System.Drawing.Size(91, 23); + this.Select.Size = new System.Drawing.Size(121, 29); this.Select.TabIndex = 0; this.Select.Text = "随机点名"; this.Select.UseVisualStyleBackColor = true; this.Select.Click += new System.EventHandler(this.Select_Click); // - // Name + // Student // - this.Name.AutoSize = true; - this.Name.Font = new System.Drawing.Font("宋体", 80F); - this.Name.Location = new System.Drawing.Point(12, 9); - this.Name.Name = "Name"; - this.Name.Size = new System.Drawing.Size(369, 107); - this.Name.TabIndex = 2; - this.Name.Text = "label1"; + this.Student.AutoSize = true; + this.Student.Font = new System.Drawing.Font("宋体", 80F); + this.Student.Location = new System.Drawing.Point(16, 11); + this.Student.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.Student.Name = "Student"; + this.Student.Size = new System.Drawing.Size(325, 134); + this.Student.TabIndex = 2; + this.Student.Text = "姓名"; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(392, 208); - this.Controls.Add(this.Name); + this.ClientSize = new System.Drawing.Size(523, 260); + this.Controls.Add(this.Student); this.Controls.Add(this.Select); this.Controls.Add(this.TxtName); this.Controls.Add(this.Read); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "Form1"; this.Text = "随机点名软件"; this.Load += new System.EventHandler(this.Form1_Load); @@ -93,7 +98,7 @@ private void InitializeComponent() private System.Windows.Forms.Button Read; private System.Windows.Forms.TextBox TxtName; private System.Windows.Forms.Button Select; - private System.Windows.Forms.Label Name; + private System.Windows.Forms.Label Student; } } diff --git a/201731023225/SelectStudent/Form1.cs b/201731023225/SelectStudent/Form1.cs index e3cb1e7..2dd8548 100644 --- a/201731023225/SelectStudent/Form1.cs +++ b/201731023225/SelectStudent/Form1.cs @@ -44,9 +44,15 @@ public void Read_Click(object sender, EventArgs e) private void Select_Click(object sender, EventArgs e) { - Random RD= new Random(); + Random RD = new Random(); + for (int i = 1; i <= 20; i++) + { + Student.Text = StudentName[RD.Next(0, StudentName.Length - 1)]; + Application.DoEvents(); + Thread.Sleep(150); + } - Name.Text= - } + Student.Text = StudentName[RD.Next(0, StudentName.Length - 1)]; + }//姓名滚动3秒后,显示随机选中的姓名 } } diff --git a/README.md b/README.md index 2cbcbef..65ebf42 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ # PairProgramming 19秋地科结对编程 +####201731023225严一笑 +####201731024237王万成 + ++ Read_Click功能由严一笑实现。 ++ Select_Click功能由王万成实现。 ++ 代码已完成互审。 + ++ Ez4EnceEnceEnceEnce dens putted upperbelt \ No newline at end of file