diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1.sln b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1.sln new file mode 100644 index 0000000..6954daf --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication1", "WindowsFormsApplication1\WindowsFormsApplication1.csproj", "{E4542EC4-7F51-4C8C-A91B-A694788B011B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E4542EC4-7F51-4C8C-A91B-A694788B011B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4542EC4-7F51-4C8C-A91B-A694788B011B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4542EC4-7F51-4C8C-A91B-A694788B011B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4542EC4-7F51-4C8C-A91B-A694788B011B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.Designer.cs new file mode 100644 index 0000000..2d8c173 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.Designer.cs @@ -0,0 +1,112 @@ +namespace WindowsFormsApplication1 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(255, 32); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 39); + this.textBox1.TabIndex = 1; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(397, 26); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(127, 45); + this.button1.TabIndex = 2; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(14, 106); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(152, 28); + this.label2.TabIndex = 3; + this.label2.Text = "计算结果:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(255, 106); + this.textBox2.Multiline = true; + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 306); + this.textBox2.TabIndex = 4; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 36); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(236, 28); + this.label1.TabIndex = 5; + this.label1.Text = "请输入一个数字:"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(536, 459); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "例1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label1; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.cs new file mode 100644 index 0000000..456928c --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.cs @@ -0,0 +1,31 @@ +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; + +namespace WindowsFormsApplication1 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + private void button1_Click(object sender, EventArgs e) + { + textBox2.Clear(); + int num = Convert.ToInt32(textBox1.Text.Trim()); + for (int i = 0; i < num; i++) + { + textBox2.Text += ("1/" + num.ToString() + "\r" + "\n"); + } + } + + + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/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/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Program.cs new file mode 100644 index 0000000..e413cbc --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication1 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..83806f8 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication1")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication1")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("5b530b52-2213-4c77-be51-c26594ab9d35")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0c83292 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication1.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("WindowsFormsApplication1.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/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/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/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Settings.Designer.cs new file mode 100644 index 0000000..e85fc55 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/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 WindowsFormsApplication1.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/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj new file mode 100644 index 0000000..8663bc9 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication1/WindowsFormsApplication1/WindowsFormsApplication1.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {E4542EC4-7F51-4C8C-A91B-A694788B011B} + WinExe + Properties + WindowsFormsApplication1 + WindowsFormsApplication1 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication1/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication1/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..36fdfbd Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication1/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10.sln b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10.sln new file mode 100644 index 0000000..877b236 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication10", "WindowsFormsApplication10\WindowsFormsApplication10.csproj", "{ED24451C-021F-419F-8F31-3801CDFA2342}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {ED24451C-021F-419F-8F31-3801CDFA2342}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED24451C-021F-419F-8F31-3801CDFA2342}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED24451C-021F-419F-8F31-3801CDFA2342}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED24451C-021F-419F-8F31-3801CDFA2342}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.Designer.cs new file mode 100644 index 0000000..7efb13e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.Designer.cs @@ -0,0 +1,148 @@ +namespace WindowsFormsApplication10 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(13, 160); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(1864, 596); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(295, 36); + this.label1.TabIndex = 1; + this.label1.Text = "请输入感知正确概率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(13, 78); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(267, 36); + this.label2.TabIndex = 2; + this.label2.Text = "请输入起始点概率:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(337, 10); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 45); + this.textBox2.TabIndex = 3; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(337, 75); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(100, 45); + this.textBox3.TabIndex = 4; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(516, 68); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(126, 56); + this.button1.TabIndex = 5; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(510, 9); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(239, 36); + this.label3.TabIndex = 6; + this.label3.Text = "请输入起始位置:"; + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox4.Location = new System.Drawing.Point(755, 4); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(131, 45); + this.textBox4.TabIndex = 7; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.ClientSize = new System.Drawing.Size(1889, 768); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.label3); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox4; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.cs new file mode 100644 index 0000000..3c1b71d --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.cs @@ -0,0 +1,112 @@ +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; + +namespace WindowsFormsApplication10 +{ + public partial class Form1 : Form + { + string[,] map = {{"red","green","green","red","red"}, + {"red","red","green","red","red"}, + {"red","red","green","green","red"}, + {"red","red","red","red","red"}}; + string rSense = "green"; + + int row = 4; + int colum = 5; + double pSenseRig = 0.7; + double pSenseWro; + double sta = 0.7; + double staAnti; + int staRow =2; + int staColum =3; + double sum = 0.0; + double pPMrx; + double[,] pMrx = new double[4, 5]; + + + public Form1() + { + InitializeComponent(); + } + + + private void button1_Click(object sender, EventArgs e) + { + string[] staArr = textBox4.Text.Trim().Split(','); + staRow = Convert.ToInt32(staArr[0]); + staColum = Convert.ToInt32(staArr[1]); + + pSenseRig = Convert.ToDouble(textBox2.Text.Trim()); + pSenseWro = 1 - pSenseRig; + + sta = Convert.ToDouble(textBox3.Text.Trim()); + staAnti = 1 - sta; + pPMrx = staAnti / (map.Length - 1); + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = pPMrx; + } + } + pMrx[staRow - 1, staColum - 1] = sta; + rSense = map[row - 1, colum - 1]; + + //显示原始概率矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + if (rSense == map[i, j]) + pMrx[i, j] = pMrx[i, j] * pSenseRig; + else + pMrx[i, j] = pMrx[i, j] * pSenseWro; + sum += pMrx[i, j]; + } + } + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = (pMrx[i, j] / sum); + } + } + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/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/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Program.cs new file mode 100644 index 0000000..2b0ff33 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication10 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1f7abb2 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication10")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication10")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("620272c0-376a-4151-bec4-2bf58eb69b0e")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Resources.Designer.cs new file mode 100644 index 0000000..60017d4 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication10.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("WindowsFormsApplication10.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/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/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/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Settings.Designer.cs new file mode 100644 index 0000000..67e222a --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/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 WindowsFormsApplication10.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/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/WindowsFormsApplication10.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/WindowsFormsApplication10.csproj new file mode 100644 index 0000000..a58b847 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication10/WindowsFormsApplication10/WindowsFormsApplication10.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {ED24451C-021F-419F-8F31-3801CDFA2342} + WinExe + Properties + WindowsFormsApplication10 + WindowsFormsApplication10 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication10/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication10/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..c65fa63 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication10/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11.sln b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11.sln new file mode 100644 index 0000000..4f818fe --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication11", "WindowsFormsApplication11\WindowsFormsApplication11.csproj", "{5FB6BFE5-36AA-421D-92FA-C16A7E8F432A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5FB6BFE5-36AA-421D-92FA-C16A7E8F432A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FB6BFE5-36AA-421D-92FA-C16A7E8F432A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FB6BFE5-36AA-421D-92FA-C16A7E8F432A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FB6BFE5-36AA-421D-92FA-C16A7E8F432A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.Designer.cs new file mode 100644 index 0000000..d05161f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.Designer.cs @@ -0,0 +1,148 @@ +namespace WindowsFormsApplication11 +{ + 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() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend4 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(6, 370); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(1385, 258); + this.textBox1.TabIndex = 0; + // + // chart1 + // + chartArea4.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea4); + legend4.Name = "Legend1"; + this.chart1.Legends.Add(legend4); + this.chart1.Location = new System.Drawing.Point(12, 12); + this.chart1.Name = "chart1"; + series4.ChartArea = "ChartArea1"; + series4.Legend = "Legend1"; + series4.Name = "Series1"; + this.chart1.Series.Add(series4); + this.chart1.Size = new System.Drawing.Size(997, 352); + this.chart1.TabIndex = 1; + this.chart1.Text = "chart1"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(1015, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(211, 36); + this.label1.TabIndex = 2; + this.label1.Text = "输入行动步骤:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(1015, 96); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(211, 36); + this.label2.TabIndex = 3; + this.label2.Text = "输入观测结果:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(1021, 48); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(370, 45); + this.textBox2.TabIndex = 4; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(1021, 135); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(370, 45); + this.textBox3.TabIndex = 5; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 26F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1055, 223); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(292, 110); + this.button1.TabIndex = 6; + this.button1.Text = "计 算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.ClientSize = new System.Drawing.Size(1403, 640); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.chart1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button button1; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.cs new file mode 100644 index 0000000..d796e2e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.cs @@ -0,0 +1,281 @@ +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.Windows.Forms.DataVisualization.Charting; + +namespace WindowsFormsApplication11 +{ + public partial class Form1 : Form + { + + public double[,] MovRight(int row, int colum,double pMovRig,double pMovWro, double[,] pMrx) + { + double[,] rPMrx = new double[row,colum]; + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + if (j == 0) + { + rPMrx[i, j] = pMovRig * pMrx[i, colum - 1] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRig * pMrx[i, j - 1] + pMovWro * pMrx[i, j]; + } + } + } + return rPMrx; + } + + public double[,] MovLeft(int row, int colum, double pMovRig, double pMovWro, double[,] pMrx) + { + double[,] rPMrx = new double[row, colum]; + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + if (j == 4) + { + rPMrx[i, j] = pMovRig * pMrx[i, 0] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRig * pMrx[i, j + 1] + pMovWro * pMrx[i, j]; + } + } + } + return rPMrx; + } + + public double[,] MovUp(int row, int colum, double pMovRig, double pMovWro, double[,] pMrx) + { + double[,] rPMrx = new double[row, colum]; + for (int j = 0; j < colum; j++) + { + for (int i = 0; i < row; i++) + { + if (i == 3) + { + rPMrx[i, j] = pMovRig * pMrx[0, j] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRig * pMrx[i + 1, j] + pMovWro * pMrx[i, j]; + } + } + } + return rPMrx; + } + + public double[,] MovDown(int row, int colum, double pMovRig, double pMovWro, double[,] pMrx) + { + double[,] rPMrx = new double[row, colum]; + for (int j = 0; j < colum; j++) + { + for (int i = 0; i < row; i++) + { + if (i == 0) + { + rPMrx[i, j] = pMovRig * pMrx[row - 1, j] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRig * pMrx[i - 1, j] + pMovWro * pMrx[i, j]; + } + } + } + return rPMrx; + } + + public double[,] MovStop(int row, int colum,double[,] pMovStop) + { + double[,] rMovStop = new double[row,colum]; + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + rMovStop[i, j] = pMovStop[i, j]; + } + } + + + + return rMovStop; + } + + public double[,] Sense(int row, int colum, string rSense, string[,] map, double pSenseRig, double pSenseWro, double[,] pMrx) + { + double sum = 0.0; + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + if (rSense == map[i, j]) + pMrx[i, j] = pMrx[i, j] * pSenseRig; + else + pMrx[i, j] = pMrx[i, j] * pSenseWro; + sum += pMrx[i, j]; + } + } + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = (pMrx[i, j] / sum); + } + } + return pMrx; + } + + public double informationH(int row, int colum, double[,] pMrx) + { + double H = 0.0; + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + H += (pMrx[i, j] * Math.Log(pMrx[i, j], 2)); + } + } + return -H; + } + + string[,] map = {{"红","绿","绿","红","绿"}, + {"红","红","绿","红","绿"}, + {"红","红","绿","绿","绿"}, + {"红","红","红","红","绿"}}; + + int row = 4; + int colum = 5; + + double pMovRig = 0.8; + double pMovWro; + double pSenseRig = 0.7; + double pSenseWro ; + double sta = 0; + double staAnti; + + double pPMrx; + double[,] pMrx = new double[4, 5]; + double[,] rPMrx = new double[4, 5]; + + string[] action = { "上", "下", "左", "右", "停" }; + string[] rAction = { "停", "右", "下", "下", "右" }; + string[] rSense = { "绿", "绿", "绿", "绿", "绿" }; + double[,] informationHofMS; + + + public Form1() + { + InitializeComponent(); + + pMovWro = 1 - pMovRig; + pSenseWro = 1 - pSenseRig; + staAnti = 1 - sta; + pPMrx = staAnti / map.Length; + informationHofMS = new double[2, rAction.Length]; + + + if (rAction.Length != rSense.Length) + MessageBox.Show("The length of the rAction should be the same as the one of the rSense"); + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = pPMrx; + } + } + } + + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Clear(); + string[] str = textBox2.Text.Trim().Split(','); + rAction = new string[str.Length]; + for (int i = 0; i < str.Length; i++) + { + rAction[i] = str[i]; + } + + str = textBox3.Text.Trim().Split(','); + rSense = new string[str.Length]; + for (int i = 0; i < str.Length; i++) + { + rSense[i] = str[i]; + } + + //显示原始概率矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + + for (int k = 0; k < rAction.Length; k++) + { + if (rAction[k] == action[0]) + pMrx = MovUp(row, colum, pMovRig, pMovWro, pMrx); + if (rAction[k] == action[1]) + pMrx = MovDown(row, colum, pMovRig, pMovWro, pMrx); + if (rAction[k] == action[2]) + pMrx = MovLeft(row, colum, pMovRig, pMovWro, pMrx); + if (rAction[k] == action[3]) + pMrx = MovRight(row, colum, pMovRig, pMovWro, pMrx); + if (rAction[k] == action[4]) + pMrx = MovStop(row, colum, pMrx); + informationHofMS[0, k] = informationH(row, colum, pMrx); + + pMrx = Sense(row, colum, rSense[k], map, pSenseRig, pSenseWro, pMrx); + informationHofMS[1, k] = informationH(row, colum, pMrx); + + } + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + + + chart1.Series.Clear(); + Series cur1 = new Series("move"); + cur1.Color = Color.Blue; + cur1.ChartType = SeriesChartType.Line; + + + Series cur2 = new Series("sense"); + cur2.Color = Color.Red; + cur2.ChartType = SeriesChartType.Line; + + + for (int i = 0; i < rAction.Length; i++) + { + cur1.Points.AddXY(i, informationHofMS[0, i]); + cur2.Points.AddXY(i, informationHofMS[1, i]); + } + chart1.Series.Add(cur1); + chart1.Series.Add(cur2); + + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/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/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Program.cs new file mode 100644 index 0000000..f1f660f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication11 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2754b29 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication11")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication11")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("3562fb9f-5d6d-4ac3-9989-459bfda14251")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Resources.Designer.cs new file mode 100644 index 0000000..f194279 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication11.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("WindowsFormsApplication11.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/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/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/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c08844d --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/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 WindowsFormsApplication11.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/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/WindowsFormsApplication11.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/WindowsFormsApplication11.csproj new file mode 100644 index 0000000..5a3e05f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication11/WindowsFormsApplication11/WindowsFormsApplication11.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {5FB6BFE5-36AA-421D-92FA-C16A7E8F432A} + WinExe + Properties + WindowsFormsApplication11 + WindowsFormsApplication11 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication11/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication11/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..4f7241a Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication11/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12.sln b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12.sln new file mode 100644 index 0000000..453bbb1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication12", "WindowsFormsApplication12\WindowsFormsApplication12.csproj", "{604C641D-6567-4EC5-B335-0F33FBDE3D4E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {604C641D-6567-4EC5-B335-0F33FBDE3D4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {604C641D-6567-4EC5-B335-0F33FBDE3D4E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {604C641D-6567-4EC5-B335-0F33FBDE3D4E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {604C641D-6567-4EC5-B335-0F33FBDE3D4E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.Designer.cs new file mode 100644 index 0000000..a6f0ab2 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.Designer.cs @@ -0,0 +1,125 @@ +namespace WindowsFormsApplication12 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(12, 120); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(595, 406); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(295, 36); + this.label1.TabIndex = 1; + this.label1.Text = "请输入得癌症的概率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(13, 68); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(211, 36); + this.label2.TabIndex = 2; + this.label2.Text = "选择诊断结果:"; + // + // comboBox1 + // + this.comboBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(314, 65); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 44); + this.comboBox1.TabIndex = 3; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(441, 13); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(166, 101); + this.button1.TabIndex = 4; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(314, 10); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(121, 45); + this.textBox2.TabIndex = 5; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(618, 540); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.button1); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox2; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.cs new file mode 100644 index 0000000..b7bdc5e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.cs @@ -0,0 +1,64 @@ +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; + +namespace WindowsFormsApplication12 +{ + public partial class Form1 : Form + { + double[] pCanOrNon = new double[2]; + double[] pPosCanPosNon = new double[2]; + double[] resultPos = new double[2]; + + + public Form1() + { + InitializeComponent(); + comboBox1.Items.Add("正确"); + comboBox1.Items.Add("错误"); + } + + private void button1_Click(object sender, EventArgs e) + { + double sum = 0; + + pCanOrNon[0] = Convert.ToDouble(textBox2.Text.Trim()); + pCanOrNon[1] = 1 - pCanOrNon[0]; + + pPosCanPosNon[0] = 0.8; + pPosCanPosNon[1] = 0.1; + + if (comboBox1.Text == "正确") + { + resultPos[0] = pCanOrNon[0] * pPosCanPosNon[0]; + resultPos[1] = pCanOrNon[1] * pPosCanPosNon[1]; + } + else + { + resultPos[0] = pCanOrNon[0] * pPosCanPosNon[1]; + resultPos[1] = pCanOrNon[1] * pPosCanPosNon[0]; + } + + for (int i = 0; i < resultPos.Length; i++) + { + sum += resultPos[i]; + } + for (int i = 0; i < resultPos.Length; i++) + { + resultPos[i] = (resultPos[i] / sum); + } + textBox1.Text = "确证得癌症概率:" + resultPos[0].ToString() + "\r"+"\n" + "确诊无癌症概率:" + resultPos[1].ToString(); + } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + textBox1.Clear(); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/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/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Program.cs new file mode 100644 index 0000000..4d6eb12 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication12 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a504980 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication12")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication12")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("53e8e4b5-fafe-4840-ae5d-8e37c2c65afa")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Resources.Designer.cs new file mode 100644 index 0000000..5fd9660 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication12.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("WindowsFormsApplication12.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/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/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/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c2a0a58 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/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 WindowsFormsApplication12.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/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/WindowsFormsApplication12.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/WindowsFormsApplication12.csproj new file mode 100644 index 0000000..a1eed33 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication12/WindowsFormsApplication12/WindowsFormsApplication12.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {604C641D-6567-4EC5-B335-0F33FBDE3D4E} + WinExe + Properties + WindowsFormsApplication12 + WindowsFormsApplication12 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13.sln b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13.sln new file mode 100644 index 0000000..8b6dad3 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication13", "WindowsFormsApplication13\WindowsFormsApplication13.csproj", "{33AF7F1D-ABE9-4ADA-AD8A-36F87714851C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {33AF7F1D-ABE9-4ADA-AD8A-36F87714851C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33AF7F1D-ABE9-4ADA-AD8A-36F87714851C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33AF7F1D-ABE9-4ADA-AD8A-36F87714851C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33AF7F1D-ABE9-4ADA-AD8A-36F87714851C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.Designer.cs new file mode 100644 index 0000000..dcfb9d6 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.Designer.cs @@ -0,0 +1,99 @@ +namespace WindowsFormsApplication13 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(12, 57); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(749, 398); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(211, 36); + this.label1.TabIndex = 1; + this.label1.Text = "请输入一组数:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(202, 6); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(445, 45); + this.textBox2.TabIndex = 2; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(653, 9); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(97, 42); + this.button1.TabIndex = 3; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(774, 469); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.cs new file mode 100644 index 0000000..13c6fc6 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.cs @@ -0,0 +1,54 @@ +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; + +namespace WindowsFormsApplication13 +{ + public partial class Form1 : Form + { + double mean = 0; + double standardDivision = 0; + double semiga2 = 0; + double[] arr; + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + double sum = 0; + + string[] tempArr = textBox2.Text.Trim().Split(','); + arr = new double[tempArr.Length]; + + for (int i = 0; i < tempArr.Length; i++) + { + arr[i] = Convert.ToDouble(tempArr[i]); + sum += Convert.ToDouble(tempArr[i]); + } + mean = (sum / tempArr.Length); + + for (int i = 0; i < tempArr.Length; i++) + { + semiga2 += ((arr[i] - mean) * (arr[i] - mean)); + } + semiga2 = (semiga2 / arr.Length); + standardDivision = Math.Sqrt(semiga2); + + textBox1.Text = "该数组的平均数为:" + mean.ToString() + "\r" + "\n" + "该数组的方差为:" + semiga2.ToString() + "\r" + "\n" + "该数组的标准差为:" + standardDivision.ToString(); + + } + + + + + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/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/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Program.cs new file mode 100644 index 0000000..d740546 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication13 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..69614de --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication13")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication13")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("fc0145a5-4b69-48a5-bb6a-8a2db965013e")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Resources.Designer.cs new file mode 100644 index 0000000..21bc52a --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication13.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("WindowsFormsApplication13.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/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/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/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Settings.Designer.cs new file mode 100644 index 0000000..7c36f8c --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/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 WindowsFormsApplication13.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/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/WindowsFormsApplication13.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/WindowsFormsApplication13.csproj new file mode 100644 index 0000000..5357343 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication13/WindowsFormsApplication13/WindowsFormsApplication13.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {33AF7F1D-ABE9-4ADA-AD8A-36F87714851C} + WinExe + Properties + WindowsFormsApplication13 + WindowsFormsApplication13 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14.sln b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14.sln new file mode 100644 index 0000000..4ef6b1e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication14", "WindowsFormsApplication14\WindowsFormsApplication14.csproj", "{82E5B3BF-D2D5-486B-8850-2CBB96CBF0AD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {82E5B3BF-D2D5-486B-8850-2CBB96CBF0AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82E5B3BF-D2D5-486B-8850-2CBB96CBF0AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82E5B3BF-D2D5-486B-8850-2CBB96CBF0AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82E5B3BF-D2D5-486B-8850-2CBB96CBF0AD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.Designer.cs new file mode 100644 index 0000000..3a11493 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.Designer.cs @@ -0,0 +1,123 @@ +namespace WindowsFormsApplication14 +{ + 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.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(239, 36); + this.label1.TabIndex = 0; + this.label1.Text = "请输入一组数组:"; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(16, 120); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(743, 476); + this.textBox1.TabIndex = 1; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(10, 71); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(431, 36); + this.label2.TabIndex = 2; + this.label2.Text = "请输入算式aX+b的两个参数a,b:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(258, 10); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(501, 45); + this.textBox2.TabIndex = 3; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(447, 68); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(180, 45); + this.textBox3.TabIndex = 4; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(633, 64); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(126, 50); + this.button1.TabIndex = 5; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(768, 608); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button button1; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.cs new file mode 100644 index 0000000..02a673d --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.cs @@ -0,0 +1,59 @@ +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; + +namespace WindowsFormsApplication14 +{ + public partial class Form1 : Form + { + double[] parameter = new double[2]; + double[] arr; + double mean = 0; + + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + double sum = 0; + string[] tempArr = textBox2.Text.Trim().Split(','); + arr = new double[tempArr.Length]; + for (int i = 0; i < tempArr.Length; i++) + { + arr[i] = Convert.ToDouble(tempArr[i]); + } + + tempArr = textBox3.Text.Trim().Split(','); + for (int i = 0; i < tempArr.Length; i++) + { + parameter[i] = Convert.ToDouble(tempArr[i]); + } + + for (int i = 0; i < arr.Length; i++) + { + sum += arr[i]; + } + mean = sum / arr.Length; + sum = 0; + textBox1.Text = "原数组的平均数为:" + mean.ToString() + "\r" + "\n"; + + for (int i = 0; i < arr.Length; i++) + { + arr[i] = (arr[i] * parameter[0] + parameter[1]); + sum += arr[i]; + } + mean = sum / arr.Length; + textBox1.Text += ("数组"+parameter[0].ToString()+"X+"+parameter[1].ToString()+"的均值为:" + mean.ToString() + "\r" + "\n"); + + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/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/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Program.cs new file mode 100644 index 0000000..82eda7e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication14 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5053fb1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication14")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication14")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("689a21b1-6c0c-4d88-bea0-20ac7dfe2708")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bc42074 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication14.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("WindowsFormsApplication14.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/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/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/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Settings.Designer.cs new file mode 100644 index 0000000..df22383 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/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 WindowsFormsApplication14.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/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/WindowsFormsApplication14.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/WindowsFormsApplication14.csproj new file mode 100644 index 0000000..a3cb548 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication14/WindowsFormsApplication14/WindowsFormsApplication14.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {82E5B3BF-D2D5-486B-8850-2CBB96CBF0AD} + WinExe + Properties + WindowsFormsApplication14 + WindowsFormsApplication14 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15.sln b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15.sln new file mode 100644 index 0000000..5a2608f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication15", "WindowsFormsApplication15\WindowsFormsApplication15.csproj", "{85533E76-D7B6-4629-A360-57EAAB88B21B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {85533E76-D7B6-4629-A360-57EAAB88B21B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85533E76-D7B6-4629-A360-57EAAB88B21B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85533E76-D7B6-4629-A360-57EAAB88B21B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85533E76-D7B6-4629-A360-57EAAB88B21B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.Designer.cs new file mode 100644 index 0000000..844e5a3 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.Designer.cs @@ -0,0 +1,99 @@ +namespace WindowsFormsApplication15 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(18, 63); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(735, 434); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(239, 36); + this.label1.TabIndex = 1; + this.label1.Text = "请输入一组数组:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(257, 12); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(381, 45); + this.textBox2.TabIndex = 2; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(644, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(109, 48); + this.button1.TabIndex = 5; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(765, 508); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.cs new file mode 100644 index 0000000..904258e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.cs @@ -0,0 +1,62 @@ +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; + +namespace WindowsFormsApplication15 +{ + public partial class Form1 : Form + { + double[] arr; + double[] parameter = new double[2]; + double semiga2 = 0; + double mean = 0; + double mean2 = 0; + + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + string[] tArr = textBox2.Text.Trim().Split(','); + double sum = 0; + arr = new double[tArr.Length]; + for (int i = 0; i < tArr.Length; i++) + { + arr[i] = Convert.ToDouble(tArr[i]); + sum += arr[i]; + } + mean = sum / arr.Length; + sum = 0; + for (int i = 0; i < arr.Length; i++) + { + semiga2 += ((arr[i] - mean) * (arr[i] - mean)); + } + semiga2 = semiga2 / arr.Length; + + textBox1.Text = "计算得原数组的平方差为:" + semiga2.ToString()+"\r"+"\n"; + + semiga2 = 0; + for (int i = 0; i < arr.Length; i++) + { + arr[i] = (arr[i] * arr[i]); + sum += arr[i]; + } + mean2 = sum / arr.Length; + + semiga2 = (mean2-(mean*mean)); + + textBox1.Text += "按照方法原数组的平方差为:" + semiga2.ToString() + "\r" + "\n"; + } + + + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/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/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Program.cs new file mode 100644 index 0000000..a0d40e5 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication15 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6f5d3fb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication15")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication15")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("fe864a7b-9974-4b9e-8204-32947fdb26ca")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ead0e64 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication15.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("WindowsFormsApplication15.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/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/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/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Settings.Designer.cs new file mode 100644 index 0000000..406b716 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/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 WindowsFormsApplication15.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/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/WindowsFormsApplication15.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/WindowsFormsApplication15.csproj new file mode 100644 index 0000000..c1c6b65 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication15/WindowsFormsApplication15/WindowsFormsApplication15.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {85533E76-D7B6-4629-A360-57EAAB88B21B} + WinExe + Properties + WindowsFormsApplication15 + WindowsFormsApplication15 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17.sln b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17.sln new file mode 100644 index 0000000..eff64c8 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication17", "WindowsFormsApplication17\WindowsFormsApplication17.csproj", "{4269C7A7-CB88-4FB1-987C-FE5E652588EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4269C7A7-CB88-4FB1-987C-FE5E652588EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4269C7A7-CB88-4FB1-987C-FE5E652588EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4269C7A7-CB88-4FB1-987C-FE5E652588EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4269C7A7-CB88-4FB1-987C-FE5E652588EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.Designer.cs new file mode 100644 index 0000000..51819f3 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.Designer.cs @@ -0,0 +1,135 @@ +namespace WindowsFormsApplication17 +{ + 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() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.button1 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); + this.chart1.Location = new System.Drawing.Point(18, 60); + this.chart1.Name = "chart1"; + series1.ChartArea = "ChartArea1"; + series1.Legend = "Legend1"; + series1.Name = "Series1"; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(1060, 525); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart1"; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(683, 9); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(111, 45); + this.button1.TabIndex = 1; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(183, 36); + this.label1.TabIndex = 2; + this.label1.Text = "请输入均值:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(341, 12); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(211, 36); + this.label2.TabIndex = 3; + this.label2.Text = "请输入标准差:"; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(201, 9); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 45); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(558, 9); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 45); + this.textBox2.TabIndex = 5; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1090, 597); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1); + this.Controls.Add(this.chart1); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.cs new file mode 100644 index 0000000..c2b6dac --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.cs @@ -0,0 +1,68 @@ +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.Windows.Forms.DataVisualization.Charting; + +namespace WindowsFormsApplication17 +{ + public partial class Form1 : Form + { + double mean = 0; + double segima = 0; + + + public double Normal(double x, double mean, double segima) + { + double result = 0; + double temp1 = 0; + double temp2 = 0; + temp1 = 1 / (Math.Sqrt(2 * Math.PI) * segima); + temp2 = Math.Exp(-(x - mean) * (x - mean) / (2 * segima * segima)); + result = temp1 * temp2; + return result; + } + + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + double[] x = new double[200]; + double[] y = new double[200]; + mean = Convert.ToDouble(textBox1.Text.Trim()); + segima = Convert.ToDouble(textBox2.Text.Trim()); + x[0] = -10; + for (int i = 1; i < x.Length; i++) + { + x[i] = (x[i - 1] + 0.1); + } + for (int i = 0; i < x.Length; i++) + { + y[i] = Normal(x[i], mean, segima); + } + chart1.Series.Clear(); + Series cur1 = new Series("高斯分布线"); + cur1.Color = Color.Red; + cur1.ChartType = SeriesChartType.Line; + + for (int i = 0; i < x.Length; i++) + { + cur1.Points.AddXY(x[i], y[i]); + } + + chart1.Series.Add(cur1); + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/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/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Program.cs new file mode 100644 index 0000000..530fc3e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication17 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..fa6f67b --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication17")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication17")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("830e8260-fbcb-48f5-929f-03be1dbd32ca")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fdc1db6 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication17.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("WindowsFormsApplication17.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/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/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/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Settings.Designer.cs new file mode 100644 index 0000000..1c4d019 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/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 WindowsFormsApplication17.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/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/WindowsFormsApplication17.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/WindowsFormsApplication17.csproj new file mode 100644 index 0000000..9f66d75 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication17/WindowsFormsApplication17/WindowsFormsApplication17.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {4269C7A7-CB88-4FB1-987C-FE5E652588EF} + WinExe + Properties + WindowsFormsApplication17 + WindowsFormsApplication17 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19.sln b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19.sln new file mode 100644 index 0000000..9baec6e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication19", "WindowsFormsApplication19\WindowsFormsApplication19.csproj", "{77E03FBD-08F3-471A-984C-30BD6B423097}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {77E03FBD-08F3-471A-984C-30BD6B423097}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77E03FBD-08F3-471A-984C-30BD6B423097}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77E03FBD-08F3-471A-984C-30BD6B423097}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77E03FBD-08F3-471A-984C-30BD6B423097}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.Designer.cs new file mode 100644 index 0000000..c2b0af0 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.Designer.cs @@ -0,0 +1,256 @@ +namespace WindowsFormsApplication19 +{ + 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() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = 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.textBox4 = new System.Windows.Forms.TextBox(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.textBox6 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.chart2 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.chart2)).BeginInit(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(250, 36); + this.label1.TabIndex = 0; + this.label1.Text = "高斯分布1的均值:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(432, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(278, 36); + this.label2.TabIndex = 1; + this.label2.Text = "高斯分布1的标准差:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(432, 65); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(283, 36); + this.label3.TabIndex = 3; + this.label3.Text = "高斯分布2的标准差:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(12, 65); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(255, 36); + this.label4.TabIndex = 2; + this.label4.Text = "高斯分布2的均值:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(432, 119); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(283, 36); + this.label5.TabIndex = 5; + this.label5.Text = "高斯分布3的标准差:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(12, 119); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(255, 36); + this.label6.TabIndex = 4; + this.label6.Text = "高斯分布3的均值:"; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(268, 6); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(111, 45); + this.textBox1.TabIndex = 6; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(716, 6); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(111, 45); + this.textBox2.TabIndex = 7; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(268, 62); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(111, 45); + this.textBox3.TabIndex = 8; + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox4.Location = new System.Drawing.Point(716, 62); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(111, 45); + this.textBox4.TabIndex = 9; + // + // textBox5 + // + this.textBox5.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox5.Location = new System.Drawing.Point(268, 116); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(111, 45); + this.textBox5.TabIndex = 10; + // + // textBox6 + // + this.textBox6.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox6.Location = new System.Drawing.Point(716, 116); + this.textBox6.Name = "textBox6"; + this.textBox6.Size = new System.Drawing.Size(111, 45); + this.textBox6.TabIndex = 11; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(12, 170); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(815, 49); + this.button1.TabIndex = 12; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // chart1 + // + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); + this.chart1.Location = new System.Drawing.Point(18, 226); + this.chart1.Name = "chart1"; + series1.ChartArea = "ChartArea1"; + series1.Legend = "Legend1"; + series1.Name = "Series1"; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(410, 432); + this.chart1.TabIndex = 13; + this.chart1.Text = "chart1"; + // + // chart2 + // + chartArea2.Name = "ChartArea1"; + this.chart2.ChartAreas.Add(chartArea2); + legend2.Name = "Legend1"; + this.chart2.Legends.Add(legend2); + this.chart2.Location = new System.Drawing.Point(438, 226); + this.chart2.Name = "chart2"; + series2.ChartArea = "ChartArea1"; + series2.Legend = "Legend1"; + series2.Name = "Series1"; + this.chart2.Series.Add(series2); + this.chart2.Size = new System.Drawing.Size(692, 432); + this.chart2.TabIndex = 14; + this.chart2.Text = "chart2"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1142, 670); + this.Controls.Add(this.chart2); + this.Controls.Add(this.chart1); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox6); + this.Controls.Add(this.textBox5); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label5); + this.Controls.Add(this.label6); + this.Controls.Add(this.label3); + this.Controls.Add(this.label4); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.chart2)).EndInit(); + 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.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.TextBox textBox6; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.DataVisualization.Charting.Chart chart2; + + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.cs new file mode 100644 index 0000000..a8c6f12 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.cs @@ -0,0 +1,207 @@ +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.Windows.Forms.DataVisualization.Charting; + +namespace WindowsFormsApplication19 +{ + public partial class Form1 : Form + { + public double[] Convolution(double[] X, double[] Y) + { + int indexX = 0, indexY = 0; + double sum = 0; + double[] A, B; + + if (X.Length >= Y.Length) + { + A = X; + B = Y; + } + else + { + B = X; + A = Y; + } + + int XLength = A.Length, YLength = B.Length; + int AllLength = XLength + YLength; + + double[] Result = new double[AllLength - 1]; + + for (int index = 0; index < AllLength - 1; index++) + { + indexX = index; + indexY = 0; + int tmpIndex = 0; + + while (tmpIndex < YLength) + { + if (indexX >= 0 && indexX < XLength) + { + sum += A[indexX] * B[indexY]; + } + else + { + if (indexX < 0) + { + break; + } + } + indexX--; + indexY++; + tmpIndex++; + } + Result[index] = sum; + sum = 0; + } + return Result; + } + + + public double[] Multiplay(double[] X, double[] Y) + { + int max = 0; + int min = 0; + if (X.Length >= Y.Length) + { + max = X.Length; + min = Y.Length; + } + else + { + max = Y.Length; + min = X.Length; + } + double[] result = new double[min]; + + for (int i = 0; i < min; i++) + { + result[i] = (X[i] * Y[i]); + } + return result; + + } + + + public double Normal(double x, double mean, double segima) + { + double result = 0; + double temp1 = 0; + double temp2 = 0; + temp1 = 1 / (Math.Sqrt(2 * Math.PI) * segima); + temp2 = Math.Exp(-(x - mean) * (x - mean) / (2 * segima * segima)); + result = temp1 * temp2; + return result; + } + + + double[] x = new double[200]; + double[] x1 = new double[400]; + + + public Form1() + { + InitializeComponent(); + + x[0] = -10; + for (int i = 1; i < x.Length; i++) + { + x[i] = (x[i - 1] + 0.1); + } + x1[0] = -20; + for (int i = 1; i < x1.Length; i++) + { + x1[i] = x1[i - 1] + 0.1; + } + + } + + private void button1_Click(object sender, EventArgs e) + { + double mean1 = 0, mean2 = 0, mean3 = 0; + double segima1 = 1, segima2 = 1, segima3 = 1; + + double[] y1 = new double[x.Length]; + double[] y2 = new double[x.Length]; + double[] y3 = new double[x.Length]; + double[] y3a; + + double[] r1 = new double[x1.Length-1]; + double[] r2 = new double[x1.Length]; + + mean1 = Convert.ToDouble(textBox1.Text.Trim()); segima1 = Convert.ToDouble(textBox2.Text.Trim()); + mean2 = Convert.ToDouble(textBox3.Text.Trim()); segima2 = Convert.ToDouble(textBox4.Text.Trim()); + mean3 = Convert.ToDouble(textBox5.Text.Trim()); segima3 = Convert.ToDouble(textBox6.Text.Trim()); + + for (int i = 0; i < x.Length; i++) + { + y1[i] = Normal(x[i], mean1, segima1); + y2[i] = Normal(x[i], mean2, segima2); + y3[i] = Normal(x[i], mean3, segima3); + } + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + chart1.Series.Clear(); + + Series cur1 = new Series("y1"); + Series cur2 = new Series("y2"); + Series cur3 = new Series("y3"); + + cur1.Color = Color.Red; + cur2.Color = Color.Green; + cur3.Color = Color.Blue; + + cur1.ChartType = SeriesChartType.Line; + cur2.ChartType = SeriesChartType.Line; + cur3.ChartType = SeriesChartType.Line; + + for (int i = 0; i < x.Length; i++) + { + cur1.Points.AddXY(x[i], y1[i]); + cur2.Points.AddXY(x[i], y2[i]); + cur3.Points.AddXY(x[i], y3[i]); + } + chart1.Series.Add(cur1); + chart1.Series.Add(cur2); + chart1.Series.Add(cur3); + + chart2.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart2.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + chart2.Series.Clear(); + + r2 = Convolution(y1, y2); + + + Series cur4 = new Series("卷积"); + cur4.Color = Color.Red; + cur4.ChartType = SeriesChartType.Line; + for (int i = 0; i < x1.Length-1; i++) + { + cur4.Points.AddXY(x1[i], r2[i]); + } + chart2.Series.Add(cur4); + + Series cur5 = new Series("乘积"); + cur5.Color = Color.Blue; + cur5.ChartType = SeriesChartType.Line; + y3a = new double[r2.Length]; + for (int i = 0; i < r2.Length; i++) + { + y3a[i] = Normal(x1[i], mean3, segima3); + } + r1 = Multiplay(y3a, r2); + for (int i = 0; i < r1.Length; i++) + { + cur5.Points.AddXY(x1[i], r1[i]); + } + chart2.Series.Add(cur5); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/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/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Program.cs new file mode 100644 index 0000000..b804a7e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication19 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1cc427f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication19")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication19")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("94261281-d5f6-43d6-aab1-e15d7599b74e")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Resources.Designer.cs new file mode 100644 index 0000000..088ac58 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication19.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("WindowsFormsApplication19.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/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/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/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Settings.Designer.cs new file mode 100644 index 0000000..571fdf3 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/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 WindowsFormsApplication19.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/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/WindowsFormsApplication19.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/WindowsFormsApplication19.csproj new file mode 100644 index 0000000..9f4a6c9 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication19/WindowsFormsApplication19/WindowsFormsApplication19.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {77E03FBD-08F3-471A-984C-30BD6B423097} + WinExe + Properties + WindowsFormsApplication19 + WindowsFormsApplication19 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2.sln b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2.sln new file mode 100644 index 0000000..297c1ae --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication2", "WindowsFormsApplication2\WindowsFormsApplication2.csproj", "{76821C83-37D5-4A68-ADC8-A893925BFFCC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.Designer.cs new file mode 100644 index 0000000..8914cd2 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.Designer.cs @@ -0,0 +1,136 @@ +namespace WindowsFormsApplication2 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(174, 163); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(346, 332); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(155, 36); + this.label1.TabIndex = 1; + this.label1.Text = "输入概率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(13, 163); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(155, 36); + this.label2.TabIndex = 2; + this.label2.Text = "显示结果:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(174, 10); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(124, 45); + this.textBox2.TabIndex = 3; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(330, 82); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(190, 47); + this.button1.TabIndex = 5; + this.button1.Text = "计算结果"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(13, 87); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(155, 36); + this.label3.TabIndex = 6; + this.label3.Text = "选择颜色:"; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(174, 84); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(124, 45); + this.textBox3.TabIndex = 7; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(568, 522); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label3); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "例2"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.cs new file mode 100644 index 0000000..34c5dc1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.cs @@ -0,0 +1,68 @@ +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; + +namespace WindowsFormsApplication2 +{ + public partial class Form1 : Form + { + string[] strArr = new string[5] { "绿", "红", "红", "绿", "绿" }; + double[] psb = new double[5]; + string str; + double hit = 0.6; + double mis = 0.2; + double sum = 0; + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Clear(); + str = textBox3.Text; + for (int i = 0; i < psb.Length; i++) + { + psb[i] = Convert.ToDouble(textBox2.Text); + } + + + + for (int i = 0; i < 5; i++) + { + if (str == strArr[i]) + { + psb[i] = psb[i] * hit; + } + else + { + psb[i] = psb[i] * mis; + } + } + + for (int i = 0; i < 5; i++) + { + sum += psb[i]; + } + + for (int i = 0; i < 5; i++) + { + psb[i] = psb[i] / sum; + } + for (int i = 0; i < 5; i++) + { + textBox1.Text += (psb[i].ToString() + "\r" + "\n"); + } + } + + + + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/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/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Program.cs new file mode 100644 index 0000000..71512e0 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication2 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7204019 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication2")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("f1bf3e8d-3a14-49d3-a490-94eb12395c21")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1b5d103 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication2.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("WindowsFormsApplication2.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/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/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/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Settings.Designer.cs new file mode 100644 index 0000000..17caf3f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/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 WindowsFormsApplication2.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/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/WindowsFormsApplication2.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/WindowsFormsApplication2.csproj new file mode 100644 index 0000000..d4a7b41 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication2/WindowsFormsApplication2/WindowsFormsApplication2.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC} + WinExe + Properties + WindowsFormsApplication2 + WindowsFormsApplication2 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication2/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication2/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..3191dcf Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication2/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.Designer.cs new file mode 100644 index 0000000..618f65c --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.Designer.cs @@ -0,0 +1,136 @@ +namespace WindowsFormsApplication2 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(174, 182); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(402, 332); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(155, 36); + this.label1.TabIndex = 1; + this.label1.Text = "输入概率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(13, 182); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(155, 36); + this.label2.TabIndex = 2; + this.label2.Text = "显示结果:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(171, 12); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(254, 45); + this.textBox2.TabIndex = 3; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(431, 13); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(145, 123); + this.button1.TabIndex = 5; + this.button1.Text = "计算结果"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(13, 92); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(155, 36); + this.label3.TabIndex = 6; + this.label3.Text = "输入颜色:"; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(171, 92); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(254, 45); + this.textBox3.TabIndex = 7; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(602, 538); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label3); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "例3"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.cs new file mode 100644 index 0000000..c15af43 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.cs @@ -0,0 +1,86 @@ +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; + +namespace WindowsFormsApplication2 +{ + public partial class Form1 : Form + { + string[] strOber; + double hit = 0.8; + double mis = 0.2; + + string[] strArr = new string[5] { "绿", "红", "红", "绿", "绿" }; + double[] psb = new double[5] { 0.2, 0.2, 0.2, 0.2, 0.2 }; + + + public void Circulation(string[] strArr, string str,double[] psb) + { + double sum = 0; + for (int i = 0; i < 5; i++) + { + if (str == strArr[i]) + { + psb[i] = psb[i] * hit; + } + else + { + psb[i] = psb[i] * mis; + } + } + + for (int i = 0; i < 5; i++) + { + sum += psb[i]; + } + + for (int i = 0; i < 5; i++) + { + psb[i] = psb[i] / sum; + } + for (int i = 0; i < 5; i++) + { + textBox1.Text += (psb[i].ToString() + "\r" + "\n"); + } + } + + + public Form1() + { + InitializeComponent(); + } + + + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Clear(); + string[] strTemp = textBox3.Text.Trim().Split(','); + strOber = new string[strTemp.Length]; + for (int i = 0; i < strTemp.Length; i++) + { + strOber[i] = strTemp[i]; + } + + + for (int i = 0; i < psb.Length; i++) + { + psb[i] = Convert.ToDouble(textBox2.Text.Trim()); + } + + + for (int i = 0; i < strOber.Length; i++) + { + Circulation(strArr,strOber[i], psb); + if (i != (strOber.Length - 1)) + textBox1.Clear(); + } + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/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/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Program.cs new file mode 100644 index 0000000..71512e0 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication2 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7204019 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication2")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("f1bf3e8d-3a14-49d3-a490-94eb12395c21")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1b5d103 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication2.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("WindowsFormsApplication2.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/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/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/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Settings.Designer.cs new file mode 100644 index 0000000..17caf3f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/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 WindowsFormsApplication2.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/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/WindowsFormsApplication3.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/WindowsFormsApplication3.csproj new file mode 100644 index 0000000..d4a7b41 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication2/WindowsFormsApplication3.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC} + WinExe + Properties + WindowsFormsApplication2 + WindowsFormsApplication2 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication3.sln b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication3.sln new file mode 100644 index 0000000..7f70e9b --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication3/WindowsFormsApplication3.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication3", "WindowsFormsApplication2\WindowsFormsApplication3.csproj", "{76821C83-37D5-4A68-ADC8-A893925BFFCC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76821C83-37D5-4A68-ADC8-A893925BFFCC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git "a/Code.C#/ShiXinQi/WindowsFormsApplication3/\350\277\220\350\241\214\347\273\223\346\236\2341.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication3/\350\277\220\350\241\214\347\273\223\346\236\2341.png" new file mode 100644 index 0000000..5357686 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication3/\350\277\220\350\241\214\347\273\223\346\236\2341.png" differ diff --git "a/Code.C#/ShiXinQi/WindowsFormsApplication3/\350\277\220\350\241\214\347\273\223\346\236\2342.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication3/\350\277\220\350\241\214\347\273\223\346\236\2342.png" new file mode 100644 index 0000000..7df2b3f Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication3/\350\277\220\350\241\214\347\273\223\346\236\2342.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4.sln b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4.sln new file mode 100644 index 0000000..1cd1f81 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication4", "WindowsFormsApplication4\WindowsFormsApplication4.csproj", "{BF804179-13D7-4F8D-B125-8608D83C68A7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BF804179-13D7-4F8D-B125-8608D83C68A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BF804179-13D7-4F8D-B125-8608D83C68A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BF804179-13D7-4F8D-B125-8608D83C68A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BF804179-13D7-4F8D-B125-8608D83C68A7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.Designer.cs new file mode 100644 index 0000000..3b4f5ca --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.Designer.cs @@ -0,0 +1,138 @@ +namespace WindowsFormsApplication4 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(12, 140); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(670, 190); + this.textBox1.TabIndex = 0; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(393, 69); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(104, 43); + this.button1.TabIndex = 1; + this.button1.Text = "左移"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(503, 69); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(104, 43); + this.button2.TabIndex = 2; + this.button2.Text = "右移"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(351, 36); + this.label1.TabIndex = 3; + this.label1.Text = "请输入数组并以逗号分隔:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(370, 10); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(227, 44); + this.textBox2.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(10, 72); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(239, 36); + this.label2.TabIndex = 5; + this.label2.Text = "请输入移动位数:"; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(255, 73); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(100, 39); + this.textBox3.TabIndex = 6; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(715, 378); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label1); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "例4"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox3; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.cs new file mode 100644 index 0000000..c88af48 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.cs @@ -0,0 +1,96 @@ +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; + +namespace WindowsFormsApplication4 +{ + public partial class Form1 : Form + { + int[] arr ; + int n = 1; + int count = 0; + int[] temp = new int[10]; + string[] str; + + public Form1() + { + InitializeComponent(); + } + + + //向右移动 + private void button2_Click(object sender, EventArgs e) + { + count++; + if (count > 3) + { + textBox1.Clear(); + count = 0; + } + n = Convert.ToInt32(textBox3.Text.Trim()); + str = textBox2.Text.Trim().Split(','); + arr = new int[str.Length]; + for (int i = 0; i < str.Length; i++) + { + arr[i] = Convert.ToInt32(str[i].Trim().ToString()); + + } + + + for (int i = 0; i < (arr.Length - n); i++) + { + temp[n + i] = arr[i]; + } + for (int i = 0; i < n; i++) + { + temp[i] = arr[arr.Length - n + i]; + } + for (int i = 0; i < arr.Length; i++) + { + textBox1.Text += (temp[i].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + + + //向左移动 + private void button1_Click(object sender, EventArgs e) + { + count++; + if (count > 3) + { + textBox1.Clear(); + count = 0; + } + n = Convert.ToInt32(textBox3.Text.Trim()); + str = textBox2.Text.Trim().Split(','); + arr = new int[str.Length]; + for (int i = 0; i < str.Length; i++) + { + arr[i] = Convert.ToInt32(str[i].Trim().ToString()); + + } + + for (int i = 0; i < (arr.Length - n); i++) + { + temp[i] = arr[n + i]; + } + for (int i = 0; i < n; i++) + { + temp[arr.Length - n + i] = arr[i]; + } + for (int i = 0; i < arr.Length; i++) + { + textBox1.Text += (temp[i].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/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/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Program.cs new file mode 100644 index 0000000..ff31a74 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication4 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b2610fd --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication4")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication4")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("03a958c1-9441-4133-bee4-36eed4c2440a")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c7286f1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication4.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("WindowsFormsApplication4.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/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/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/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c604bcb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/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 WindowsFormsApplication4.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/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/WindowsFormsApplication4.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/WindowsFormsApplication4.csproj new file mode 100644 index 0000000..726086b --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication4/WindowsFormsApplication4/WindowsFormsApplication4.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {BF804179-13D7-4F8D-B125-8608D83C68A7} + WinExe + Properties + WindowsFormsApplication4 + WindowsFormsApplication4 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication4/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication4/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..06dc6a3 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication4/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5.sln b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5.sln new file mode 100644 index 0000000..7956a22 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication5", "WindowsFormsApplication5\WindowsFormsApplication5.csproj", "{25F207CA-843B-436F-875E-0C5B97A14BE1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {25F207CA-843B-436F-875E-0C5B97A14BE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25F207CA-843B-436F-875E-0C5B97A14BE1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25F207CA-843B-436F-875E-0C5B97A14BE1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25F207CA-843B-436F-875E-0C5B97A14BE1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.Designer.cs new file mode 100644 index 0000000..cf58059 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.Designer.cs @@ -0,0 +1,136 @@ +namespace WindowsFormsApplication5 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(13, 179); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(623, 337); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(7, 62); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(211, 36); + this.label1.TabIndex = 1; + this.label1.Text = "输入步进长度:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(224, 62); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 45); + this.textBox2.TabIndex = 2; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(360, 62); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(120, 51); + this.button1.TabIndex = 3; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(7, 126); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(155, 36); + this.label2.TabIndex = 4; + this.label2.Text = "输出结果:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(7, 9); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(155, 36); + this.label3.TabIndex = 5; + this.label3.Text = "输入数组:"; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(144, 6); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(492, 45); + this.textBox3.TabIndex = 6; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(648, 528); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "例5"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.cs new file mode 100644 index 0000000..0f86277 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.cs @@ -0,0 +1,88 @@ +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; + +namespace WindowsFormsApplication5 +{ + public partial class Form1 : Form + { + //mod函数计算方法 + /* public int Divided(int a, int b) + { + int c; + if (a < 0) + { + c = a / b; + c = (a - b * c); + c += b; + } + else + { + c = a / b; + c = (a - b * c); + } + return c; + }*/ + + + + int j = 0; + double[] pEvent = {0,0.5,0,0.5,0}; + double[] pUnderOver = { 0.1, 0.8, 0.1 }; + double[] pRut = new double[5]; + int step = 2; + int over = 0; + int exact = 0; + int under = 0; + + + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Clear(); + string[] strP = textBox3.Text.Trim().Split(','); + pEvent = new double[strP.Length]; + pRut = new double[strP.Length]; + + for (int i = 0; i < strP.Length; i++) + { + pEvent[i] = Convert.ToDouble(strP[i]); + } + + step = Convert.ToInt32(textBox2.Text.Trim()); + + + for (int i = 0; i < pRut.Length; i++) + { + under = j + step - 1; + exact = j + step; + over = j + step + 1; + + if (over >= pEvent.Length) + over -= pEvent.Length; + if (exact >= pEvent.Length) + exact -= pEvent.Length; + if (under >= pEvent.Length) + under -= pEvent.Length; + + pRut[i] = pUnderOver[0] * pEvent[under] + pUnderOver[1] * pEvent[exact] + pUnderOver[2] * pEvent[over]; + j++; + } + j = 0; + for (int i = 0; i < pRut.Length; i++) + { + textBox1.Text += (pRut[i].ToString() + "\r" + "\n"); + } + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/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/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Program.cs new file mode 100644 index 0000000..e3c5375 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication5 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2dd3843 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication5")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication5")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("78f4ede6-3a1e-4068-919c-438b3048c5da")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7dc4d5e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication5.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("WindowsFormsApplication5.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/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/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/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Settings.Designer.cs new file mode 100644 index 0000000..34c2e20 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/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 WindowsFormsApplication5.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/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/WindowsFormsApplication5.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/WindowsFormsApplication5.csproj new file mode 100644 index 0000000..92512fe --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication5/WindowsFormsApplication5/WindowsFormsApplication5.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {25F207CA-843B-436F-875E-0C5B97A14BE1} + WinExe + Properties + WindowsFormsApplication5 + WindowsFormsApplication5 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication5/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication5/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..e8f5117 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication5/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6.sln b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6.sln new file mode 100644 index 0000000..b959ada --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication6", "WindowsFormsApplication6\WindowsFormsApplication6.csproj", "{306353C3-89D2-4FA5-8F77-714406E20E47}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {306353C3-89D2-4FA5-8F77-714406E20E47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {306353C3-89D2-4FA5-8F77-714406E20E47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {306353C3-89D2-4FA5-8F77-714406E20E47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {306353C3-89D2-4FA5-8F77-714406E20E47}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.Designer.cs new file mode 100644 index 0000000..cd8463b --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.Designer.cs @@ -0,0 +1,136 @@ +namespace WindowsFormsApplication6 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(13, 171); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(843, 421); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 132); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(155, 36); + this.label1.TabIndex = 1; + this.label1.Text = "计算结果:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(7, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(155, 36); + this.label2.TabIndex = 2; + this.label2.Text = "输入数组:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(228, 6); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(444, 45); + this.textBox2.TabIndex = 3; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(389, 60); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(133, 48); + this.button1.TabIndex = 4; + this.button1.Text = "计算"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(7, 66); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(211, 36); + this.label3.TabIndex = 5; + this.label3.Text = "输入循环次数:"; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(228, 63); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(155, 45); + this.textBox3.TabIndex = 6; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(868, 604); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label3); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "例6"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox3; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.cs new file mode 100644 index 0000000..463fff3 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.cs @@ -0,0 +1,78 @@ +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; + +namespace WindowsFormsApplication6 +{ + public partial class Form1 : Form + { + int j = 0; + double[] pEvent = { 0, 0.5, 0, 0.5, 0 }; + double[] pUnderOver = { 0.1, 0.8, 0.1 }; + double[] pRut = new double[5]; + int step = 1; + int over = 0; + int exact = 0; + int under = 0; + int num = 24; + + + public Form1() + { + InitializeComponent(); + } + + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Clear(); + string[] str = textBox2.Text.Trim().Split(','); + pEvent = new double[str.Length]; + for (int i = 0; i < str.Length; i++) + { + pEvent[i] = Convert.ToDouble(str[i]); + } + + num = Convert.ToInt32(textBox3.Text.Trim()); + + for (int k = 0; k < num; k++) + { + + for (int i = 0; i < pRut.Length; i++) + { + under = j + step - 1; + exact = j + step; + over = j + step + 1; + + if (over >= pEvent.Length) + over -= pEvent.Length; + if (exact >= pEvent.Length) + exact -= pEvent.Length; + if (under >= pEvent.Length) + under -= pEvent.Length; + + pRut[i] = pUnderOver[0] * pEvent[under] + pUnderOver[1] * pEvent[exact] + pUnderOver[2] * pEvent[over]; + j++; + } + j = 0; + + + for (int i = 0; i < pRut.Length; i++) + { + pEvent[i] = pRut[i]; + } + } + + for (int i = 0; i < pRut.Length; i++) + { + textBox1.Text += (pRut[i].ToString() + "\r" + "\n"); + } + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/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/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Program.cs new file mode 100644 index 0000000..1fef47c --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication6 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0e4681c --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication6")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication6")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("86763b03-a1a7-4abe-be91-a2aca69c26ba")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Resources.Designer.cs new file mode 100644 index 0000000..283cfbc --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication6.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("WindowsFormsApplication6.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/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/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/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Settings.Designer.cs new file mode 100644 index 0000000..7ce5a39 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/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 WindowsFormsApplication6.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/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/WindowsFormsApplication6.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/WindowsFormsApplication6.csproj new file mode 100644 index 0000000..20de24e --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication6/WindowsFormsApplication6/WindowsFormsApplication6.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {306353C3-89D2-4FA5-8F77-714406E20E47} + WinExe + Properties + WindowsFormsApplication6 + WindowsFormsApplication6 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication6/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication6/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..7c7c6ef Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication6/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65.sln b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65.sln new file mode 100644 index 0000000..447fef5 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication65", "WindowsFormsApplication65\WindowsFormsApplication65.csproj", "{A9FFA0F1-C900-486D-AFDB-C405F1EE143B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A9FFA0F1-C900-486D-AFDB-C405F1EE143B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9FFA0F1-C900-486D-AFDB-C405F1EE143B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9FFA0F1-C900-486D-AFDB-C405F1EE143B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9FFA0F1-C900-486D-AFDB-C405F1EE143B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.Designer.cs new file mode 100644 index 0000000..2a6f501 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.Designer.cs @@ -0,0 +1,136 @@ +namespace WindowsFormsApplication65 +{ + 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() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + 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(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + legend2.Name = "Legend1"; + this.chart1.Legends.Add(legend2); + this.chart1.Location = new System.Drawing.Point(12, 48); + this.chart1.Name = "chart1"; + series2.ChartArea = "ChartArea1"; + series2.Legend = "Legend1"; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(737, 462); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart1"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(155, 36); + this.label1.TabIndex = 1; + this.label1.Text = "计算结果:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(12, 526); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(127, 36); + this.label2.TabIndex = 2; + this.label2.Text = "概率值:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(12, 598); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(127, 36); + this.label3.TabIndex = 3; + this.label3.Text = "信息熵:"; + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(155, 523); + this.textBox1.Name = "textBox1"; + this.textBox1.ReadOnly = true; + this.textBox1.Size = new System.Drawing.Size(219, 45); + this.textBox1.TabIndex = 4; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(155, 595); + this.textBox2.Name = "textBox2"; + this.textBox2.ReadOnly = true; + this.textBox2.Size = new System.Drawing.Size(219, 45); + this.textBox2.TabIndex = 5; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(771, 676); + 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.Controls.Add(this.chart1); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + 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; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.cs new file mode 100644 index 0000000..e779be9 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.cs @@ -0,0 +1,63 @@ +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.Windows.Forms.DataVisualization.Charting; + + +namespace WindowsFormsApplication65 +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + double p; + double pAnti; + double[] xLabel = new double[100]; + double[] yLabel = new double[100]; + double xMax = 0.0; + double yMax = 0.0; + for (int i = 1; i < 100; i++) + { + p = (double) i/100; + pAnti = 1 - p; + xLabel[i] = p; + yLabel[i] = (p * Math.Log(p,2) + pAnti*Math.Log(pAnti,2)); + yLabel[i] = -yLabel[i]; + } + + + for (int i = 0; i < 100; i++) + { + if (yLabel[i] >= yMax) + { + yMax = yLabel[i]; + xMax = xLabel[i]; + } + } + + + + chart1.Series.Clear(); + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + Series curve = new Series("cur"); + + curve.ChartType = SeriesChartType.Line; + + for (int i = 0; i < 100; i++) + { + curve.Points.AddXY(xLabel[i], yLabel[i]); + } + chart1.Series.Add(curve); + textBox1.Text = xMax.ToString() +","+ (1 - xMax).ToString(); + textBox2.Text = yMax.ToString(); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/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/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Program.cs new file mode 100644 index 0000000..683a1be --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication65 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a0e4d43 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication65")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication65")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("d797a715-0393-4a9d-a63c-8b2831c49c59")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8d3bca1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication65.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("WindowsFormsApplication65.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/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/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/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Settings.Designer.cs new file mode 100644 index 0000000..94ee36a --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/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 WindowsFormsApplication65.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/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/WindowsFormsApplication65.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/WindowsFormsApplication65.csproj new file mode 100644 index 0000000..5c83e8a --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication65/WindowsFormsApplication65/WindowsFormsApplication65.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {A9FFA0F1-C900-486D-AFDB-C405F1EE143B} + WinExe + Properties + WindowsFormsApplication65 + WindowsFormsApplication65 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication65/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication65/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..fc41b70 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication65/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7.sln b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7.sln new file mode 100644 index 0000000..7991a97 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication7", "WindowsFormsApplication7\WindowsFormsApplication7.csproj", "{49697441-4682-42CF-9D67-1328EBBDD314}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {49697441-4682-42CF-9D67-1328EBBDD314}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49697441-4682-42CF-9D67-1328EBBDD314}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49697441-4682-42CF-9D67-1328EBBDD314}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49697441-4682-42CF-9D67-1328EBBDD314}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.Designer.cs new file mode 100644 index 0000000..1dca3b9 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.Designer.cs @@ -0,0 +1,87 @@ +namespace WindowsFormsApplication7 +{ + 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() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.button1 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea2.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea2); + legend2.Name = "Legend1"; + this.chart1.Legends.Add(legend2); + this.chart1.Location = new System.Drawing.Point(12, 80); + this.chart1.Name = "chart1"; + series2.ChartArea = "ChartArea1"; + series2.Legend = "Legend1"; + series2.Name = "Series1"; + this.chart1.Series.Add(series2); + this.chart1.Size = new System.Drawing.Size(878, 574); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart1"; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("幼圆", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(12, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(152, 62); + this.button1.TabIndex = 1; + this.button1.Text = "转换为点"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(902, 666); + this.Controls.Add(this.button1); + this.Controls.Add(this.chart1); + this.Name = "Form1"; + this.Text = "例7"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.Button button1; + + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.cs new file mode 100644 index 0000000..8020572 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.cs @@ -0,0 +1,114 @@ +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.Windows.Forms.DataVisualization.Charting; + +namespace WindowsFormsApplication7 +{ + public partial class Form1 : Form + { + int j = 0; + double[] pEvent = { 0, 0.5, 0, 0.5, 0 }; + double[] pUnderOver = { 0.1, 0.8, 0.1 }; + double[] pRut = new double[5]; + + int step = 1; + int over = 0; + int exact = 0; + int under = 0; + int num = 24; + double[] chartY; + + public Form1() + { + InitializeComponent(); + + chartY = new double[num]; + + for (int k = 0; k < num; k++) + { + for (int i = 0; i < pRut.Length; i++) + { + under = j + step - 1; + exact = j + step; + over = j + step + 1; + + if (over >= pEvent.Length) + over -= pEvent.Length; + if (exact >= pEvent.Length) + exact -= pEvent.Length; + if (under >= pEvent.Length) + under -= pEvent.Length; + + pRut[i] = pUnderOver[0] * pEvent[under] + pUnderOver[1] * pEvent[exact] + pUnderOver[2] * pEvent[over]; + j++; + } + j = 0; + + + for (int i = 0; i < pRut.Length; i++) + { + pEvent[i] = pRut[i]; + } + + chartY[k] = 0.0; + + for (int i = 0; i < pEvent.Length; i++) + { + + chartY[k] += pEvent[i] * Math.Log(pEvent[i], 2); + } + chartY[k] = -chartY[k]; + } + chart1.Series.Clear(); + Series cur = new Series("信息熵值变化"); + cur.ChartType = SeriesChartType.Line; + for (int i = 0; i < chartY.Length; i++) + { + cur.Points.AddXY(i, chartY[i]); + } + chart1.Series.Add(cur); + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + + } + + private void button1_Click(object sender, EventArgs e) + { + if (button1.Text == "转换为点") + { + button1.Text = "转换为线"; + chart1.Series.Clear(); + Series cur = new Series("信息熵值变化"); + cur.ChartType = SeriesChartType.Point; + for (int i = 0; i < chartY.Length; i++) + { + cur.Points.AddXY(i, chartY[i]); + } + chart1.Series.Add(cur); + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + } + else + { + button1.Text = "转换为点"; + chart1.Series.Clear(); + Series cur = new Series("信息熵值变化"); + cur.ChartType = SeriesChartType.Line; + for (int i = 0; i < chartY.Length; i++) + { + cur.Points.AddXY(i, chartY[i]); + } + chart1.Series.Add(cur); + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + } + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/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/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Program.cs new file mode 100644 index 0000000..62e8a73 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication7 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..27f1c38 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication7")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication7")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("2ea46637-5296-4ed2-808d-c98a898a6332")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Resources.Designer.cs new file mode 100644 index 0000000..22a268d --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication7.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("WindowsFormsApplication7.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/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/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/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3032635 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/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 WindowsFormsApplication7.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/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/WindowsFormsApplication7.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/WindowsFormsApplication7.csproj new file mode 100644 index 0000000..25fd5a8 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication7/WindowsFormsApplication7/WindowsFormsApplication7.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {49697441-4682-42CF-9D67-1328EBBDD314} + WinExe + Properties + WindowsFormsApplication7 + WindowsFormsApplication7 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication7/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication7/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..a58fee5 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication7/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8.sln b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8.sln new file mode 100644 index 0000000..5511fb3 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication8", "WindowsFormsApplication8\WindowsFormsApplication8.csproj", "{CF3AE958-2254-4CED-9C62-93B268A176AA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CF3AE958-2254-4CED-9C62-93B268A176AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF3AE958-2254-4CED-9C62-93B268A176AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF3AE958-2254-4CED-9C62-93B268A176AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF3AE958-2254-4CED-9C62-93B268A176AA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.Designer.cs new file mode 100644 index 0000000..300a354 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.Designer.cs @@ -0,0 +1,100 @@ +namespace WindowsFormsApplication8 +{ + 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() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea3.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea3); + legend3.Name = "Legend1"; + this.chart1.Legends.Add(legend3); + this.chart1.Location = new System.Drawing.Point(12, 12); + this.chart1.Name = "chart1"; + series3.ChartArea = "ChartArea1"; + series3.Legend = "Legend1"; + series3.Name = "Series1"; + this.chart1.Series.Add(series3); + this.chart1.Size = new System.Drawing.Size(773, 605); + this.chart1.TabIndex = 1; + this.chart1.Text = "chart1"; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(791, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(204, 64); + this.button1.TabIndex = 2; + this.button1.Text = "转换为点"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(791, 82); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(204, 81); + this.button2.TabIndex = 3; + this.button2.Text = "显示信息熵"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1211, 629); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.chart1); + this.Name = "Form1"; + this.Text = "例8"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.cs new file mode 100644 index 0000000..ab571bb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.cs @@ -0,0 +1,185 @@ +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.Windows.Forms.DataVisualization.Charting; + + +namespace WindowsFormsApplication8 +{ + public partial class Form1 : Form + { + + public double informationH(double[] pEvent) + { + double result = 0; + for (int i = 0; i < pEvent.Length; i++) + { + result += (pEvent[i] * Math.Log(pEvent[i], 2)); + } + result = -result; + return result; + } + + + //p = sense(p, measurements(i), world, pHit, pMiss); + public double[] Sense(double[] psb,string strSee,string[] strMap,double hit,double mis) + { + double sum = 0; + + for (int i = 0; i < strMap.Length; i++) + { + if (strSee == strMap[i]) + { + psb[i] = psb[i] * hit; + } + else + { + psb[i] = psb[i] * mis; + } + } + for (int i = 0; i < 5; i++) + { + sum += psb[i]; + } + + for (int i = 0; i < 5; i++) + { + psb[i] = psb[i] / sum; + } + return psb; + } + + + //p = move(p, motions(i), pExact, pOvershoot, pUndershoot); + + double[] Move(double[] pEvent,int step,double[] pUnderOver) + { + int j = 0; + + double[] pRut = new double[pEvent.Length]; + + int over = 0; + int exact = 0; + int under = 0; + + for (int i = 0; i < pRut.Length; i++) + { + under = j + step - 1; + exact = j + step; + over = j + step + 1; + + if (over >= pEvent.Length) + over -= pEvent.Length; + if (exact >= pEvent.Length) + exact -= pEvent.Length; + if (under >= pEvent.Length) + under -= pEvent.Length; + + pRut[i] = pUnderOver[0] * pEvent[under] + pUnderOver[1] * pEvent[exact] + pUnderOver[2] * pEvent[over]; + j++; + } + + return pRut; + } + + double[] pEvent = { 0.2, 0.2, 0.2, 0.2, 0.2 }; + string[] map = { "green", "red", "red", "green", "green" }; + string[] see = { "red", "green" }; + int[] step = { 1, 1 }; + double hit = 0.6; + double mis = 0.2; + + double[] pUnderOver = { 0.1, 0.8, 0.1 }; + double[,] resultH ; + + Series cur1 = new Series("sense"); + Series cur2 = new Series("move"); + + + public Form1() + { + InitializeComponent(); + resultH = new double[2, see.Length]; + + for (int i = 0; i < see.Length; i++) + { + pEvent = Sense(pEvent, see[i], map, hit, mis); + resultH[0, i] = informationH(pEvent); + pEvent = Move(pEvent, step[i], pUnderOver); + resultH[1, i] = informationH(pEvent); + } + + + + chart1.Series.Clear(); + + cur1.Color = Color.Blue; + cur1.ChartType = SeriesChartType.Line; + cur1.IsValueShownAsLabel = false; + + + + cur2.Color = Color.Red; + cur2.ChartType = SeriesChartType.Line; + //cur2.IsValueShownAsLabel = true; + + + for (int i = 0; i < see.Length; i++) + { + cur1.Points.AddXY(i, resultH[0, i]); + cur2.Points.AddXY(i, resultH[1, i]); + } + chart1.Series.Add(cur1); + chart1.Series.Add(cur2); + + chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; + chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; + } + + private void button1_Click(object sender, EventArgs e) + { + if (button1.Text == "转换为点") + { + button1.Text = "转换为线"; + + cur1.ChartType = SeriesChartType.Point; + cur2.ChartType = SeriesChartType.Point; + } + else + { + button1.Text = "转换为点"; + + cur1.ChartType = SeriesChartType.Line; + cur2.ChartType = SeriesChartType.Line; + } + } + + private void button2_Click(object sender, EventArgs e) + { + if (button2.Text == "显示信息熵") + { + button2.Text = "隐藏信息熵"; + + cur1.IsValueShownAsLabel = true; + cur2.IsValueShownAsLabel = true; + } + else + { + button2.Text = "显示信息熵"; + + cur1.IsValueShownAsLabel = false; + cur2.IsValueShownAsLabel = false; + } + } + + + + + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/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/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Program.cs new file mode 100644 index 0000000..bbb96a7 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication8 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f5e93e5 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication8")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication8")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("aa2c07c3-2292-4341-bb3a-0f46ac01fe6d")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Resources.Designer.cs new file mode 100644 index 0000000..4b3f533 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication8.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("WindowsFormsApplication8.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/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/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/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f982533 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/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 WindowsFormsApplication8.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/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/WindowsFormsApplication8.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/WindowsFormsApplication8.csproj new file mode 100644 index 0000000..8ecc616 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication8/WindowsFormsApplication8/WindowsFormsApplication8.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {CF3AE958-2254-4CED-9C62-93B268A176AA} + WinExe + Properties + WindowsFormsApplication8 + WindowsFormsApplication8 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication8/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication8/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..d961e8a Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication8/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9.sln b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9.sln new file mode 100644 index 0000000..696d8d0 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApplication9", "WindowsFormsApplication9\WindowsFormsApplication9.csproj", "{81D0B448-60CB-49F7-A393-19E63160450F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {81D0B448-60CB-49F7-A393-19E63160450F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81D0B448-60CB-49F7-A393-19E63160450F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81D0B448-60CB-49F7-A393-19E63160450F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81D0B448-60CB-49F7-A393-19E63160450F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/App.config b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.Designer.cs new file mode 100644 index 0000000..4a65c52 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.Designer.cs @@ -0,0 +1,191 @@ +namespace WindowsFormsApplication9 +{ + 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.textBox1 = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + 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.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("微软雅黑 Light", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(12, 174); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(1357, 491); + this.textBox1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(211, 36); + this.label1.TabIndex = 1; + this.label1.Text = "设定起始概率:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(13, 88); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(267, 36); + this.label2.TabIndex = 2; + this.label2.Text = "设定移动正确概率:"; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(288, 10); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(187, 45); + this.textBox2.TabIndex = 3; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox3.Location = new System.Drawing.Point(288, 85); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(187, 45); + this.textBox3.TabIndex = 4; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button1.Location = new System.Drawing.Point(1065, 10); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(149, 48); + this.button1.TabIndex = 5; + this.button1.Text = "向上移动"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(910, 82); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(149, 48); + this.button2.TabIndex = 6; + this.button2.Text = "向左移动"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button3.Location = new System.Drawing.Point(1065, 82); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(149, 48); + this.button3.TabIndex = 7; + this.button3.Text = "向下移动"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button4.Location = new System.Drawing.Point(1220, 82); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(149, 48); + this.button4.TabIndex = 8; + this.button4.Text = "向右移动"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(504, 13); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(211, 36); + this.label3.TabIndex = 9; + this.label3.Text = "设定起始位置:"; + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("微软雅黑 Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox4.Location = new System.Drawing.Point(699, 10); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(187, 45); + this.textBox4.TabIndex = 10; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange; + this.ClientSize = new System.Drawing.Size(1387, 677); + this.Controls.Add(this.textBox4); + this.Controls.Add(this.label3); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textBox1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox4; + } +} + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.cs b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.cs new file mode 100644 index 0000000..1e8433f --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.cs @@ -0,0 +1,295 @@ +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; + +namespace WindowsFormsApplication9 +{ + public partial class Form1 : Form + { + string[,] map = {{"red","green","green","red","red"}, + {"red","red","green","red","red"}, + {"red","red","green","green","red"}, + {"red","red","red","red","red"}}; + int row = 4; + int colum = 5; + int staRow; + int staColum; + double pMovRro = 0.8; + double pMovWro; + double sta = 0.7; + double staAnti; + double pPMrx; + double[,] pMrx = new double[4, 5]; + double[,] rPMrx = new double[4, 5]; + + + public Form1() + { + InitializeComponent(); + } + + + private void button1_Click(object sender, EventArgs e) + { + textBox1.Clear(); + sta = Convert.ToDouble(textBox2.Text.Trim()); + + string[] staLocation = textBox4.Text.Trim().Split(','); + staRow = Convert.ToInt32(staLocation[0]); + staColum = Convert.ToInt32(staLocation[1]); + + pMovWro = 1 - pMovRro; + staAnti = 1 - sta; + pPMrx = staAnti / (map.Length - 1); + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = pPMrx; + } + } + pMrx[staRow - 1, staColum - 1] = sta; + + //显示原始概率矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + + + //向上移动 + for (int j = 0; j < colum; j++) + { + for (int i = 0; i < row; i++) + { + if (i == 3) + { + rPMrx[i, j] = pMovRro * pMrx[0, j] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRro * pMrx[i + 1, j] + pMovWro * pMrx[i, j]; + } + } + } + + //显示移动后的矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (rPMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + } + + private void button3_Click(object sender, EventArgs e) + { + textBox1.Clear(); + sta = Convert.ToDouble(textBox2.Text.Trim()); + + string[] staLocation = textBox4.Text.Trim().Split(','); + staRow = Convert.ToInt32(staLocation[0]); + staColum = Convert.ToInt32(staLocation[1]); + + pMovWro = 1 - pMovRro; + staAnti = 1 - sta; + pPMrx = staAnti / (map.Length - 1); + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = pPMrx; + } + } + pMrx[staRow - 1, staColum - 1] = sta; + + //显示原始概率矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + + //向下移动 + for (int j = 0; j < colum; j++) + { + for (int i = 0; i < row; i++) + { + if (i == 0) + { + rPMrx[i, j] = pMovRro * pMrx[row - 1, j] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRro * pMrx[i - 1, j] + pMovWro * pMrx[i, j]; + } + } + } + + //显示移动后的矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (rPMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + } + + private void button2_Click(object sender, EventArgs e) + { + textBox1.Clear(); + sta = Convert.ToDouble(textBox2.Text.Trim()); + + string[] staLocation = textBox4.Text.Trim().Split(','); + staRow = Convert.ToInt32(staLocation[0]); + staColum = Convert.ToInt32(staLocation[1]); + + pMovWro = 1 - pMovRro; + staAnti = 1 - sta; + pPMrx = staAnti / (map.Length - 1); + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = pPMrx; + } + } + pMrx[staRow - 1, staColum - 1] = sta; + + //显示原始概率矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + + //向左移动 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + if (j == 4) + { + rPMrx[i, j] = pMovRro * pMrx[i, 0] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRro * pMrx[i, j + 1] + pMovWro * pMrx[i, j]; + } + } + } + + //显示移动后的矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (rPMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + } + + private void button4_Click(object sender, EventArgs e) + { + textBox1.Clear(); + sta = Convert.ToDouble(textBox2.Text.Trim()); + + string[] staLocation = textBox4.Text.Trim().Split(','); + staRow = Convert.ToInt32(staLocation[0]); + staColum = Convert.ToInt32(staLocation[1]); + + pMovWro = 1 - pMovRro; + staAnti = 1 - sta; + pPMrx = staAnti / (map.Length - 1); + + + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + pMrx[i, j] = pPMrx; + } + } + pMrx[staRow - 1, staColum - 1] = sta; + + //显示原始概率矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (pMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + textBox1.Text += "\r" + "\n"; + + //向右移动 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + if (j == 0) + { + rPMrx[i, j] = pMovRro * pMrx[i, colum - 1] + pMovWro * pMrx[i, j]; + } + else + { + rPMrx[i, j] = pMovRro * pMrx[i, j - 1] + pMovWro * pMrx[i, j]; + } + } + } + + //显示移动后的矩阵 + for (int i = 0; i < row; i++) + { + for (int j = 0; j < colum; j++) + { + textBox1.Text += (rPMrx[i, j].ToString() + " "); + } + textBox1.Text += ("\r" + "\n"); + } + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.resx b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/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/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Program.cs b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Program.cs new file mode 100644 index 0000000..904949c --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsApplication9 +{ + static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/AssemblyInfo.cs b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0a97875 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("WindowsFormsApplication9")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WindowsFormsApplication9")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("731185b6-7629-45c4-ba99-760942268bb6")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Resources.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Resources.Designer.cs new file mode 100644 index 0000000..5d27dc0 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WindowsFormsApplication9.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("WindowsFormsApplication9.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/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Resources.resx b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/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/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Settings.Designer.cs b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Settings.Designer.cs new file mode 100644 index 0000000..e5412e5 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/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 WindowsFormsApplication9.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/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Settings.settings b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/WindowsFormsApplication9.csproj b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/WindowsFormsApplication9.csproj new file mode 100644 index 0000000..b1ad9b1 --- /dev/null +++ b/Code.C#/ShiXinQi/WindowsFormsApplication9/WindowsFormsApplication9/WindowsFormsApplication9.csproj @@ -0,0 +1,88 @@ + + + + + Debug + AnyCPU + {81D0B448-60CB-49F7-A393-19E63160450F} + WinExe + Properties + WindowsFormsApplication9 + WindowsFormsApplication9 + v4.5 + 512 + + + 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/Code.C#/ShiXinQi/WindowsFormsApplication9/\350\277\220\350\241\214\347\273\223\346\236\234.png" "b/Code.C#/ShiXinQi/WindowsFormsApplication9/\350\277\220\350\241\214\347\273\223\346\236\234.png" new file mode 100644 index 0000000..c65fa63 Binary files /dev/null and "b/Code.C#/ShiXinQi/WindowsFormsApplication9/\350\277\220\350\241\214\347\273\223\346\236\234.png" differ