精华内容
下载资源
问答
  • Windows窗体程序设计

    2014-01-22 22:02:50
    关于c++的Windows窗体程序设计编程
  • Windows窗体应用程序设计小一

    万次阅读 多人点赞 2019-01-07 23:50:06
    一,windows 窗体应用程序是由控件组成的,控件是可以重复使用的类或组件 MessageBoxButtons枚举值及其说明 成员名称 说明 MessageBoxButtons.AbortRetryIgore 消息框包含“终止”,“重试”,...

    首先创建一个简单的windous窗体应用程序,名为Form1
    一,windows 窗体应用程序是由控件组成的,控件是可以重复使用的类或组件

    MessageBoxButtons枚举值及其说明
    成员名称 说明
    MessageBoxButtons.AbortRetryIgore 消息框包含“终止”,“重试”,“忽略”按钮
    MessageBoxButtons.OK 消息框包含“确定”按钮
    MessageBoxButtons.OKCancel 消息框包含“确定”和“取消”按钮
    MessageBoxButtons.RetryCancel 消息框包含“重试”和“取消”按钮
    MessageBoxButtons.YesNo 消息框包含“是”或“否”按钮
    MessageBoxButtons.YesNoCancel 消息框包含“是”,“否”,和“取消”按钮

    DialogResult*枚举值及其说明
    成员名称 说明
    Abort : (对话框的返回值是Abort(通常从标题为“中止”按钮))
    Cancel : ( 对话框的返回值是Cancel(通常从标题为“取消”的按钮发送))
    Ignore:(对话框的返回值是Ignore(通常从标题为“忽略”的按钮发送))
    No:(对话框的返回值是No(通常从标题为“否”的按钮发送))
    None:(从对话框返回了Nothing,这表明有模式对话框继续执行)
    OK:(对话框的返回值是OK(通常从标题为“确定”的按钮发送))
    Retry:(对话框的返回值的Retry(通常从标题为“重试”的按钮发送))
    Yes:(对话框的返回值是Yes(通常从标题为“是”的按钮发送))

    有一个小例子:

    private void button1_Click(object sender, EventArgs e)
            {
                MessageBox.Show("你单击了button1");
            }
    
    

    运行结果:

    在这里插入图片描述

    例如,以下三个语句的结果如下:

    
                MessageBox.Show("三个按钮","信息提示",MessageBoxButtons.AbortRetryIgnore);
                MessageBox.Show("三个按钮","信息提示",MessageBoxButtons.YesNoCancel);
                MessageBox.Show("两个按钮","信息提示",MessageBoxButtons.OKCancel);
    

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    二,Windows窗体应用程序的结构
    从一个简单的窗体应用程序中可以找到一个Program.cs文件,它是主程序文件,双击该文件名可以看到其代码

    namespace porj1
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
        }
    }
    
    

    其中有一个Program静态类,包含一个Main静态方法,这与控制台应用程序相似,所不用的是,通过Application.Run(new Form1())语句执行Form1窗体。这里Form1是启动窗体,如果要执行其他窗体如Form2,只需要将其中的“Form1”改为“Form2”即可。Application类是应用程序类
    另外,每个窗体如Form1对应一个Form1.cs节点,展开它时还会看到Form1.Designer,cs和Form1.resx.前者为窗体设计文件,其代码是由Visual Studio自动生成的,一般不需要修改,后者为其资源文件
    双击Form1.Designer.cs看到其代码,其中用于初始化Form1的代码如下

    private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(211, 104);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(187, 98);
                this.button1.TabIndex = 0;
                this.button1.Text = "button1";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(800, 450);
                this.Controls.Add(this.button1);
                this.Name = "Form1";
                this.Text = "Form1";
                this.ResumeLayout(false);
    
            }
    

    上述代码是由程序员的设计操作转换而来的,是由系统自动生成的,主要包含button1和Form1两部分。其中,this.button1.Click += new System.EvenHandler(this.button1_Click)语句将button1事件Click与对应的事件处理方法button_Click相关联,称为事件订阅,其一般格式为:

    object.Event +=new EventHandle(Method);
    

    其中,EventHandler是.NET Framework预置好的一个特殊的委托。它的形式是固定的。上述语句的意识是,如果对象object发生了Event事件,就交由方法Method来处理。一个对象可以委托多个不同的处理,“+=”用来增加新的委托关系。Method是真正进行事件处理的地方。正因为如此,在执行Form1中用户单击button1时才会执行button1_Click

    三,常用的控件设计
    控件:是包含在窗体上的对象,是构成用户界面的基本元素,也是c#可视化编程的重要工具。使用控件可以减少程序设计中大量重复性的工作。有效的提高设计效率。要快捷的编写出好的应用程序,必须掌握各种控件的功能,用于以及其常用的属性。
    工具箱中包含建立应用程序的各种控件,根据控件的不同用途分为若干个选项卡,可根据用途单击相应的选项卡标签,将其展开,选择需要的控件。
    控件的外观和行为,如控件的大小、颜色、位置以及控件使用方式等特征,是由它的属性决定的。不同的控件拥有不用的属性,并且系统为它提供的默认值也不同。大多数默认值设置比较合理,能满足一般情况下的需求。此外,每个控件还有它专门的属性,大多数控件还包含一些更高级的属性,在进入高级应用程序开发阶段会很有用。

    • 控件共有的属性
      (1)Name属性,可通过此名称来引用这个控件,c#会给每个新产生的控价指定一个默认名,一般由控件类型和序号组成
      (2)Text属性,获取或设置文本的属性,
      (3)尺寸大小(Size)和位置(Location),各种控件一般都有一个设置其尺寸大小和位置的属性,即Size和Location属性。Size属性可用于设置控件的宽度和高度。Location属性可用于设置一个控件相对于它所在窗体左上角的(x,y)坐标值。这两个属性既可以通过输入新的设置值来改变,也可以随着控件的缩放或拖动而改变。
      (4)字体属性(Forn)如果一个控件要显示文字,可通过Forn属性来改变她的显示字体

    设置控件字体的方法是,在“属性”窗口中单击Font属性,它的右边就会显示一个按钮,再单击这个按钮,就弹出一个“字体”对话框,通过“字体”对话框就可以选择所用的字体、字样和字号等。Font也是一个C#类,它的基本属性如下:

    • Name:获取此Font的字体名称
    • Size:获取此Font的大小,单位采用Unit属性指定的单位
    • Unit:获取此Font的度量单位
    • Bold:获取一个值,该值指示此Font是否为粗体
    • Italic:获取一个值,该值指示此Font是否为斜体
    • Strikeout:获取一个值,该值指示此Font是否指定贯穿字体的横线
    • Underline:获取一个值,该值指示此Font是否有下划线
      事实上,采用“字体”对话框就是设置上述属性

    (5)颜色属性(BlackColor和ForeColor)
    控件的背景颜色是由BlackColor属性设置的;控件要显示的文字或图形的颜色,则是由ForeColor属性设置的
    (6)Cursor属性
    Cursor属性主要功能是获取或设置当鼠标指针位于控件上时显示的光标,将Custor分配给控件的Curstor属性,以便更改在鼠标指针位于该控件上的显示的光标
    (7)可见(Visible)和有效(Enabled)属性
    一个控件的可见属性Visible确定了该控件在用户界面上是否可见。一个控件的有效属性Enabled决定了该控件能否被使用。当一个控件的Enabled属性设置为False,它变成灰色显示,单击这个控件时不会起作用。如果一个控件的Visual属性设置为False,则在用户界面上就看不到这个控件,它的Enable属性也就无关紧要。所以,设置的一般原则是控件总是可见的,但不必总是有效的。

    窗体控件:
    窗体(Form)控件是一个容器,其中可以放置其他控件,除了上述共有的属性外,窗体控件还有一些特定的属性
    (1)StartPosition属性:获取或设置执行时窗体的起始位置。取值为Manual时表示窗体的位置由Location属性确定;取值为CenterScreen时表示窗体在当前显示窗口中居中,其尺寸在窗体大小中指定;取值为CenterPatent时表示窗体在其父窗体中居中,等等。
    (2)MaximizeBox属性:获取或设置一个值,该值指示是否在窗体的标题栏中显示“最大化”按钮
    (3)MinimizeBox属性:获取或设置一个值,该值指示是否在该窗体的标题栏中显示“最小化”按钮
    (4)ControlBox属性:获取或设置一个值,该值指示在该窗体的标题栏中是否显示控件框

    窗体控件的一些常用方法:

    1. Activate方法:激活窗体并给予它焦点
    2. Close方法:关闭窗体
    3. Focus方法:为控件设置输入焦点
    4. Hide方法:对用户隐藏控件
    5. Show方法:将窗体显示为五模式对话框。所谓无模式对话框就是在显示该窗体后用户可以不必响应,然后随意切换到其他窗体或程序进行操作。通常情况下,当建立新的窗体时,都默认设置为无模式窗体
    6. ShowDialog方法:将窗体显示为模式对话框。所谓模式对话框及时在屏幕上显示该窗体后用户必须响应,只有在它关闭之后才能操作其他窗体或程序

    事件编程是Windows应用程序设计的基础,在窗体控件上预设了很多事件,当用户设置了某些事件处理方法时,系统会自动捕获事件并执行相应的事件处理方法。当一个窗体启动时,常见窗体事件的处理次序如下:
    (1)本窗体上的Load事件
    (2)本窗体上的Activated事件
    (3)本窗体上的其他Form级事件
    (4)本窗体上包含控件的相关事件

    一个窗体被卸载时,常见的窗体事件的处理次序如下:
    (1)本窗体上的Closing事件
    (2)本窗体上的FormClosing事件
    (3)本窗体上的Closed事件
    (4)本窗体上的FormClosed事件

    展开全文
  • c#windows窗体程序设计

    万次阅读 多人点赞 2013-04-12 12:08:47
    一:windows窗体程序设计 (1)窗体创建的几种方式 using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace WindowsFormsApplication1 { static ...

    一:windows窗体程序设计

    (1)窗体创建的几种方式

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
        static class Program
        {
            /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //  Application.Run(new Form1());
                Form1 f1 = new Form1();
             
                Form2 f2 = new Form2();
                f2.Show();
                Form3 f3 = new Form3();
                f3.Show();
    
                Application.Run(f1);
            }
        }
    }
    

    (2)编写事件处理程序

    1 、选中控件
    2 、在“属性”窗口中单击“闪电”图标
    3 、找到要处理的事件
    4 、生成事件处理方法
    5 、编写处理代码
    例:随鼠标移动,显示鼠标当前坐标
    点击选中窗体
    属性窗体中找到 MouseMove 事件
    双击事件生成事件处理程序框架
    编写代码
    private voidForm1_MouseMove(object sender, MouseEventArgs e ){
           this.Text = String.Format(“鼠标位置({0},{1})", e.X,e.Y ); }


    常用窗体事件

    Load  :窗体加载事件(即将显示尚未显示),常用作初始化功能
    Click 事件:鼠标单击事件
    DoubleClick 事件:鼠标双击事件
    MouseMove :鼠标移动事件
    KeyDown :键盘按下事件
    KeyUp :键盘释放事件
    小例子:单击窗体计 1 分,双击窗体计 10 分,编写程序,随时显示得分总数。
    定义变量 n 存储分数,初值为 0
    单击事件 click n+1 ,并刷新
    双击事件 DoubleClick n+10 ,并刷新
    private void Form1_Click(object sender, EventArgs e)
            {
                n += 1;
                string s = string.Format("得分{0}", n);
                this.Text = s;
    
            }
    
            private void Form1_DoubleClick(object sender, EventArgs e)
            {
                n += 10;
                string s = string.Format("得分{0}", n);
                this.Text = s;
    
            }




    (3)菜单控件
    设计学生管理菜单 , 注意菜单分隔条的设计
    实现“退出”功能
    关闭窗体,调用窗体类的 Close 方法 
    关闭当前窗体  this.Close ( );

     private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                this.Close();
            }



    (4)消息框

    // 最简单的消息框
    MessageBox.Show ( “ 消息内容 " );
    // 带标题的消息框
    MessageBox.Show (“ 消息内容 ”, “ 标题 ");
    // 带标题、指定按钮的消息框
    MessageBox.Show 消息内容 ”,  标题 ",   MessageBoxButtons.OKCancel );
    例:窗体上放一个按钮“发射核弹”,点此按钮后,访问用户,你确实要发射核弹吗?显示两个选项按钮:是、否。
    如果用户选择是,则提示:核弹已经发射,你将为你所作所为付出代价。
    如果用户选择否,则提示:你在最后关键时刻做出正确的抉择,避免了巨大损失。
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                DialogResult r= MessageBox.Show("你确实要发射核弹吗?","请确认",MessageBoxButtons.YesNo);
                if (r == DialogResult.Yes)
                {
                    MessageBox.Show("核弹已经发射,你将为你所作所为付出代价","请确认");
    
                }
                else
                MessageBox.Show("你在最后关键时刻做出正确的抉择,避免了巨大损失。","请确认");
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                pictureBox1.Top -= 5;
            }
    
            private void button5_Click(object sender, EventArgs e)
            {
    
            }
    
            private void pictureBox1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void button4_Click(object sender, EventArgs e)
            {
                pictureBox1.Left -= 5;
            }
    
            private void button5_Click_1(object sender, EventArgs e)
            {
                pictureBox1.Left += 5;
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
                pictureBox1.Top += 5;
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
    
            }
    
            private void textBox2_TextChanged(object sender, EventArgs e)
            {
    
            }
    
            private void 加数_TextChanged(object sender, EventArgs e)
            {
    
            }
    
            private void button6_Click(object sender, EventArgs e)
            {
                double a, b, c;
                a = double.Parse(加数.Text);
                b = double.Parse(被加数.Text);
                c = a + b;
                和.Text = c.ToString();
            }
        }
    }
    

    运行图如下:这是多个实验的代码




    (5)使用窗体控件
    目录
    文本框TextBox
    单选框RadioButton和复选框CheckBox
    分组框GroupBox
    工具栏ToolStript和状态栏StatusStrip
    图片框PictureBox
    定时器Timer
    多文档用户界面MDI
    控件公用属性
    Visible :是否可见
    Enabled :是否可用
    Left :横坐标
    Top : 纵坐标
    Width: 宽度
    Height :高度
    ---------------------------------------------------------------------
    文本框 TextBox
    属性窗口中为控件命名(变量名)
    读取文本
    String s =textBox1.Text;
    显示文本
    textBox1.Text=“ 要显示的文字 ”;
    单选框 RadioButton
    多选一,互斥
    是否选中 :Checked 属性
    如果选中则做某项工作
    if(radioButton1.Checked) …
    设置选中 RadioButton
    radioButton1.Checked= true;

     private void button1_Click(object sender, EventArgs e)
            {
                if (radioButton1.Checked)
                    MessageBox.Show("恭喜你答对了", "请确定");
                else
                    MessageBox.Show("很遗憾你答错啦", "正确答案是鲸鱼");



    复选框 CheckBox
    多个选项多选多
    是否选中 :Checked 属性
    如果选中则做某项工作
    if(checkBox1.Checked) …
    设置选中 CheckBox
    checkBox1.Checked =true;
    例:调查业余爱好,并提示“你的业余爱好有 ……

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace cho5
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void label1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                /*string hobby = "";
                if (checkBox1.Checked)
                    hobby += checkBox1.Text + ",";
                if (checkBox2.Checked)
                    hobby += checkBox2.Text + ",";
                if (checkBox3.Checked)
                    hobby += checkBox3.Text + ",";
                if (checkBox4.Checked)
                    hobby += checkBox4.Text + ",";
                if (checkBox5.Checked)
                    hobby += checkBox5.Text + ",";
    
                MessageBox.Show("你的业余爱好有:" + hobby);
                 * 
                 */
                string hobby = "";
                CheckBox[] array = { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5 };
                    for (int i = 0; i < array.Length; i++)
    			{
    			  if(array[i].Checked)
                     hobby+=array[i].Text+",";
    			}
    
                 MessageBox.Show("你的业余爱好有:" + hobby);
            }
        }
    }
    

    分组框 GroupBox
    一个容器,用于组织分散的控件,使界面整齐美观。
    填写用户注册信息,分为 2 部分,基本信息和教育信息。
    问题:如果一个窗体上既有选择性别的 RadioButton ,又有选择学历的 RadioButton ,则它们之间如何实现正确的互斥?
    可用容器将不同 RadioButton 分组,例如 GroupBox
    图片框PictureBox
    用于显示图片。
    常用属性:
    SizeMode :图片尺寸模式(缩放、拉伸等)
    常用方法:
    Load(“ 位置 ”) 。 可从磁盘或网络上加载并显示一幅图片。
    定时器Timer
    用于周期性的执行任务。
    重要属性:
    Interval : 定时间隔,以毫秒为单位
    Enabled : 是否启动计时
    重要事件:
    Tick : 定时间隔到达
    int n = 10;
            private void timer1_Tick(object sender, EventArgs e)
            {
                n--;
                label1.Text = n.ToString();
               
            }


    定时器 Timer
    例:导弹发射
    窗体底部,有个“发射”按钮,旁边一个 PictureBox 放一个导弹图片。
    点击“开始”,从 10 开始倒计时。
    倒计时到 0 时,导弹开始向上移动,直到移出窗体。
    用到的知识:
    控件的 Left 属性表示横坐标, Top 属性表示纵坐标
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace cho5
    {
        public partial class Form2 : Form
        {
            public Form2()
            {
                InitializeComponent();
            }
            int n = 10;
            private void timer1_Tick(object sender, EventArgs e)
            { 
                n--;
             
                label1.Text = n.ToString();
                if (n == 0)
                {
                    timer1.Enabled = false;
                    timer2.Enabled = true;
                }
    
            }
    
            private void Form2_Load(object sender, EventArgs e)
            {
    
            }
    
            private void pictureBox1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                timer1.Enabled = true;
            }
    
            private void timer2_Tick(object sender, EventArgs e)
            {
                pictureBox1.Top -= 10;
                if (pictureBox1.Top <= 0)
                    timer2.Enabled = false;
            }
        }
    }
    





    工具条 ToolStrip

    用于在窗体(通常是顶部)显示工具栏。
    是一个容器,其中可包含多个工具栏按钮等控件。
    常用属性:
    ImageScalingSize   工具条上按钮图片缩放尺寸

    工具条

    例:设计一个服务器工具条,上有 4 个按钮:启动 / 继续、暂停、停止、退出
    按钮同时显示文字和图片
    图片缩放成 32 个像素大小
    各个按钮之间要实现互斥逻辑关系:即服务启动以后,启动按钮不可用,暂停、停止可用。停止后,停止、暂停不可用,启动可用。退出按钮永远可用。
    状态条StatusStrip
    状态条 StatusStrip 与工具条 ToolStrip 类似,但通常里面包含 Label 而非 Button
    例:在状态条上显示当前时间,并实时刷新
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    
    namespace cho6
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
            {
    
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                toolStripButton1.Enabled = true;
                toolStripButton2.Enabled = false;
                toolStripButton3.Enabled = false;
    
            }
    
            private void toolStripButton4_Click(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void toolStripButton1_Click(object sender, EventArgs e)
            {
                toolStripButton1.Enabled = false; 
                toolStripButton2.Enabled = true;
                toolStripButton3.Enabled = true;
            }
    
            private void toolStripButton2_Click(object sender, EventArgs e)
            {
                toolStripButton1.Enabled = true;
                toolStripButton2.Enabled = false;
                toolStripButton3.Enabled = false;
            }
    
            private void toolStripButton3_Click(object sender, EventArgs e)
            {
                toolStripButton1.Enabled = true;
                toolStripButton2.Enabled = false;
                toolStripButton3.Enabled = false;
            }
    
            private void firstToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form2 f = new Form2();
                f.MdiParent = this;
                f.Show();
            }
    
            private void secondToolStripMenuItem_Click(object sender, EventArgs e)
            {
                Form3 f = new Form3();
                f.MdiParent = this;
                f.Show();
            }
        }
    }
    


    创建子窗体

    private void button1_Click_1(object sender, EventArgs e)
            {
                string s = "server=.;database=SampleDb;User Id=sa;Password=123;";
                SqlConnection c = new SqlConnection(s);
                c.Open();
                MessageBox.Show("数据库连接成功,接下来可以写数据啦");
                c.Close();
                     
            }





    展开全文
  • C#-Windows窗体应用程序设计
  • c#Windows窗体应用程序设计,8.1 窗体设计 8.2 常用的控件设计 8.3 多文档窗体 8.4 窗体设计的事件机制
  • 长相丑陋,功能单一的初代计算器,只能实现两个数之间的加减乘除和取余。判断小数点是否重复输入,可以在文本框输入数字和小数点,判断输入数据是否合法(不能输入字母符号空格等)
  • C# Windows窗体应用程序设计 简易实例操作(一)

    千次阅读 多人点赞 2020-04-18 16:52:20
    C# Windows窗体应用程序设计 简易实例操作(一) 大家好,这是我第一次写博客。写这个的目的一来是为了巩固自己所学的东西,二是希望通过简单的例子来激发对编程学习的热情,互相促进学习。在后面我也会更新其他的...

    C# Windows窗体应用程序设计

                    简易实例操作(一)
    

    大家好,这是我第一次写博客。写这个的目的一来是为了巩固自己所学的东西,二是希望通过简单的例子来激发对编程学习的热情,互相促进学习。在后面我也会更新其他的内容,第一次写难免有不足的地方,希望大家指正,有什么问题也可以留言讨论,谢谢大家。

    1. 实例运行环境

    Microsoft Visual Studio 2017,下面附上下载链接。
    单击此处即可
    进入网站后下载社区版(community),CSDN里面也有写好的安装教程。

    实际案例及操作

    1概要

    通过对一般例子的掌握,熟悉各个控件作用及其操作方法,进而加深和流利地进行c# Windows窗体应用程序的开发。因为c# Windows窗体应用程序控件比较多,每次以单独的控件加上简单案例,在熟悉以后可以综合起来解决一些比较大的问题。
    主菜单设计
    ① 首先新建一个名为MainMenu的窗体应用程序,将窗体 Text属性设为“主菜单演示”。命名直接在该部件的Text属性栏,双击后输入。
    ② 在“工具箱”中找到“公共控件”,并在其中选取“TextBox”,并将其拖动其进入窗体,在窗体中添加一个文本框textBox1。每个控件的Text属性是设置窗体能够显现的名字的作用。新安装的vs2017如果没有发现工具箱,则需在“视图”里面打开,或者按Ctrl+alt+X,即可出现。
    ③ 继续在工具箱中找到“菜单和工具栏”,在选中“MenuStrip”,并拖动其进入窗体,即下图一中居中的白框(该框可以横向拉伸);然后建立如图所示菜单(如图二)
    ==图一==
    图二
    在输入菜单选项名称时,可为菜单项添加快捷键方式,格式为(&+任意字符),以本例子中的“文件”为例,在输入名字时,在后面添加(&F),程序运行后,按alt+F即可快速打开该菜单栏。以该方式设置的快捷键都是alt+设置的字符打开。
    ④ 代码:c# Windows窗体应用设计中,添加控件只是完成了一部分,如果不向其中添加代码,则不会有所预想的功能。添加代码的方式为双击相应的控件,即可跳转到相应位置。
    下面附上代码:

    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 主菜单设计
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
         private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
            {
            }
            private void 重置RToolStripMenuItem_Click(object sender, EventArgs e)
            {
                textBox1.Text = "欢迎使用主菜单";
            }
            private void 清空CToolStripMenuItem_Click(object sender, EventArgs e)
            {
                textBox1.Text = "";
            }
            private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
            {
                this.Close();
            }
            private void 关于AToolStripMenuItem_Click(object sender, EventArgs e)
            {
                MessageBox.Show("主菜单演示,菜单选项的使用", "提示");
            }
            private void Form1_Load(object sender, EventArgs e)
            {
            }
        }
    }
    
    

    ⑤ 运行效果图:
    运行效果图
    今天的分享到此结束,在最开始给的例子比较简单,后面会慢慢增加难度的,有什么建议或者问题可以留言。

    展开全文
  • Windows窗体应用程序设计 1 窗体设计 2 常用的控件设计 3 多文档窗体 4 窗体设计的事件机制
  • 应用.NET类库中的栈类Stack完成十进制转换成二进制、八进制、十六进制。要求应用 Windows窗体程序设计实现,界面美观,功能完善。
  • C# Windows窗体应用程序设计综合实例(二)--------学生成绩管理系统 今天给大家更新一个综合实例,学生成绩管理系统。从需求分析、窗体应用程序的编写、运行结果来阐述整个过程 需求分析 首先先要进行需求分析,...

    C# Windows窗体应用程序设计综合实例(二)--------学生成绩管理系统

    今天给大家更新一个综合实例,学生成绩管理系统。从需求分析、窗体应用程序的编写、运行结果来阐述整个过程
    (文末和评论区有源代码文件,需要自取,建议先看内容再看源代码,代码描述部分可忽略,比较长,影响观看时间。)

    需求分析

    首先先要进行需求分析,需求分析就是想清楚你写的窗体应用具体要实现哪些功能。最好把它用表格的形式列出来。本次实例的需求如下表格。

    窗体功能描述
    主窗体对整个系统的功能进行汇总和导航
    添加对输入系统内的学生成绩进行添加输入数据
    保存至TXT将系统内的成绩导出系统
    从TXT导入从系统外导入成绩信息
    查找根据特定信息查找学生的成绩信息
    排序按照特定要求进行降序或者升序排序
    删除对特定学生的成绩信息进行删除
    修改找到学生信息再修改相应的值

    接下来我们了解了需求后,就开始在大脑里面构思具体的一个情景。

    整体构思

    假定这个系统完成了,你在使用的时候首先出现的应该是导航的页面,也就是主窗体,上面有各个功能的按钮。然后接着是每个功能对应的窗体的情景。最后退出结束。这一步的目的是为了在写的时候有一个大致的布局和编写习惯的预定判定。就像是一个工程师在心里画好了图纸,到时候就不用考虑布局和习惯的问题,只需要关注代码之间的逻辑和语法问题
    在这里插入图片描述
    下面就是整个最煎熬的步骤了,也就是按照前面说讲的窗体应用程序设计的步骤来完成。

    窗体应用程序设计的编写

    选取学生信息的存储结构

    本次由于是做成绩管理系统,就要想好具体在程序里面的存储结构。这里我们用典型的单链表作为存储结构来存储学生的各项信息。
    那么可能有一部分不太了解数据结构的小伙伴就比较疑惑了,接下来简单介绍一下单链表。
    单链表的结构如下:
    在这里插入图片描述
    每个节点由数据域和指针域构成,在开头的的节点有一个头指针。该存储结构的优点是在进行某些操作的时候便于修改。具体的内容自行查找知识点,这里不做过多解释。(文末和评论区有源代码,需要自取)

    设置布局

    接下来我们就开始设置窗体的布局,如下图所示:
    1.主界面
    在这里插入图片描述
    2.修改在这里插入图片描述
    3.添加在这里插入图片描述
    4.删除在这里插入图片描述
    5.排序
    在这里插入图片描述
    6.查找
    在这里插入图片描述
    在这里说明一下,在写的过程中,最好是完成一个界面就运行检查一次,不要等到写完了再去查错,工作量比较大容易混乱。

    控件布局及属性设置

    在了解了布局后,我们接下来根据具体的要求进行属性的设置,属性设置如下:
    注意:控件较多的情况下,name属性会自动命名为控件名+加入的顺序,例如加入两个label,第一个自动命名为label1,第二个就为label2。因此后面添加控件按照表格的顺序来一个一个搞好再添加,不然容易混乱与代码对不上。
    在这里插入图片描述
    在这里再强调一下,最好是完成一个界面就运行检查一次,不要等到写完了再去查错,工作量比较大容易混乱!
    最好是完成一个界面就运行检查一次,不要等到写完了再去查错,工作量比较大容易混乱!
    最好是完成一个界面就运行检查一次,不要等到写完了再去查错,工作量比较大容易混乱! 重要的事情说三遍。
    2.排序在这里插入图片描述
    3.查找
    在这里插入图片描述
    4.删除
    在这里插入图片描述
    5.修改
    在这里插入图片描述
    在这里插入图片描述
    6.添加
    在这里插入图片描述
    在这里插入图片描述
    严格注意区分name属性里面的大小写,具体事项见备注。

    添加代码

    添加代码的方法就是双击你的控件,对应的添加。具体的可以看主页之前写的匹配游戏设计和数学测验器。

    ***************************************
    前方高能,非战斗人员请撤离
    请爱护好自己的眼睛
    ***************************************
    1.Program.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using System.Windows.Forms;
        namespace C_sharp学生成绩管理系统
        {
            public class Node
            {
                //数据域,当前结点数据
    
                //信息
                public int id;
                public string name;
                public string classnum;
            internal object tiyu;
            internal object yingyu;
            internal object shuxue;
            //分数
            public int c_sharp { set; get; }
                public int ds { set; get; }
                public int maogai { set; get; }
                public int ps { set; get; }   
                public int sports { set; get; }
    
                public double total { set; get; }
                public double average { set; get; }
                //指针   
                public Node Next { set; get; }    //位置域,下一个结点地址
                //构造函数
                public Node(int id, string name, string classnum, int c_sharp, int ds, int maogai, int ps,int sports)
                {
                    this.id = id;
                    this.name = name;
                    this.classnum = classnum;
                    this.c_sharp = c_sharp;
                    this.ds = ds;
                    this.maogai = maogai;
                    this.ps = ps;
                    this.sports = sports;
    
                    this.total = this.c_sharp + this.ds + this.maogai + this.ps  + this.sports;
                    this.average = this.total / 6;
    
                    this.Next = null;
                }
            }
            public class LinkList
            {
                public Node Head { set; get; } //单链表头
                public int total { set; get; } //总人数
    
                //构造
                public LinkList()
                {
                    Head = null;
                    total = 0;
                }
    
                //增加新元素到单链表末尾
                public static void Append(int id, string name, string classnum, int c_sharp, int ds, int maogai, int ps,  int sports)
                {
                    Node foot = new Node(id, name, classnum, c_sharp, ds,maogai, ps,  sports);
                    Node A = new Node(id, name, classnum, c_sharp, ds, maogai, ps, sports);
    
                    if (PublicValue.Head == null)
                    {
                        PublicValue.Head = foot;
                        return;
                    }
                    A = PublicValue.Head;
                    while (A.Next != null)
                    {
                        A = A.Next;
                    }
                    A.Next = foot;
                }
            }
    
            //全局变量
            public class PublicValue
            {
                public static Node Head; //单链表头
                public static Node Tail; //单链表尾
                public static int total; //学生总数
            }
            /// 应用程序的主入口点
            static class Program
            {
                /// <summary>
                /// 应用程序的主入口点
                /// </summary>
                [STAThread]
                static void Main()
                {
                    LinkList link = new LinkList();
    
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new MainForm());
                }
            }
        }
    
    

    2.主界面:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.IO;//Stream流类
    
    namespace C_sharp学生成绩管理系统
    {
        public partial class MainForm : Form
        {
    
            public MainForm()
            {
                InitializeComponent();
            }
    
           
    
            private void SaveTXT_Click_1(object sender, EventArgs e)
            {
                //清空txt
                System.IO.File.WriteAllText(@"data.txt", string.Empty);
    
                //写入
                StreamWriter sw = new StreamWriter("data.txt", true, Encoding.Default);
                Node B = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                B = PublicValue.Head;
    
                sw.Write(PublicValue.total + "\r\n");
                while (B != null)
                {
                    sw.Write(B.id + "\r\n" + B.classnum + "\r\n" + B.name + "\r\n" + B.c_sharp + "\r\n" + B.ds + "\r\n" + B.maogai + "\r\n" + B.ps + "\r\n" + +B.sports + "\r\n");
                    B = B.Next;
                }
    
                //清空缓冲区
                sw.Flush();
    
                //关闭流
                sw.Close();
    
                MessageBox.Show("保存成功");
            }
    
            private void AppendTxt_Click(object sender, EventArgs e)
            {
                int i;
    
                FileStream fs = new FileStream("data.txt", FileMode.Open);
                StreamReader sr = new StreamReader(fs, Encoding.Default);
    
                //临时接收
                int id;
                string name;
                string classnum;
                int c_sharp;
                int ds;
                int maogai;
                int ps;
                int sports;
    
                PublicValue.total = int.Parse(sr.ReadLine());
    
                for (i = 0; i < PublicValue.total; i++)
                {
                    id = int.Parse(sr.ReadLine());
                    name = sr.ReadLine();
                    classnum = sr.ReadLine();
    
                    c_sharp = int.Parse(sr.ReadLine());
                    ds = int.Parse(sr.ReadLine());
                    maogai = int.Parse(sr.ReadLine());
                    ps = int.Parse(sr.ReadLine());
                    sports = int.Parse(sr.ReadLine());
    
                    LinkList.Append(id, classnum, name, c_sharp, ds, maogai, ps, sports);
    
                }
                sr.Close();
                MessageBox.Show("导入成功");
                List_Click_1(null, null);
            }
    
            private void List_Click_1(object sender, EventArgs e)
            {
                Node B = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                B = PublicValue.Head;
    
                Change.Text = "";//先清空
                Change.Text += "  学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\t总分\t平均分\r\n";
                while (B != null)
                {
                    Change.Text += B.id + " \t" + B.classnum + "\t" + B.name + "\t" + B.c_sharp + "\t" + B.ds + "\t" + "\t" + B.maogai + "\t" + B.ps + "\t" +  + B.sports + "\t" + B.total + "\t" + B.average.ToString("f2") + "\r\n";
                    B = B.Next;
                }
            }
    
            private void ch_Click(object sender, EventArgs e)
            {
                ChangeStuForm f3 = new ChangeStuForm();
                f3.ShowDialog();
                List_Click_1(null, null);
            }
    
            private void Delete_Click_1(object sender, EventArgs e)
            {
                DelStuForm f4 = new DelStuForm();
                f4.ShowDialog();
                List_Click_1(null, null);
            }
    
            private void Find_Click_1(object sender, EventArgs e)
            {
    
                FindForm f6 = new FindForm();
                f6.ShowDialog();
            }
    
            private void Sort_Click_1(object sender, EventArgs e)
            {
                SortForm f5 = new SortForm();
                f5.ShowDialog();
                List_Click_1(null, null);
            }
    
            private void Exit_Click_1(object sender, EventArgs e)
            {
                System.Environment.Exit(0);
            }
    
            private void Add_Click(object sender, EventArgs e)
            {
                AddStuForm f2 = new AddStuForm();
                f2.ShowDialog();
                List_Click_1(null, null);
            }
    
            private void MainForm_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    

    3.修改

    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 C_sharp学生成绩管理系统
    {
        public partial class ChangeStuForm : Form
        {
            private Button button1;
            private Button button2;
            private TextBox textBox1;
            private TextBox textBox2;
            private TextBox textBox3;
            private TextBox textBox4;
            private TextBox textBox5;
            private TextBox textBox6;
            private TextBox textBox7;
            private TextBox textBox8;
            private Label label1;
            private Label label2;
            private Label label3;
            private Label label4;
            private Label label5;
            private Label label6;
            private Label label7;
            private Label label8;
            private TextBox textBox9;
            private Label label9;
            private Button button3;
    
            public ChangeStuForm()
            {
                InitializeComponent();
            }
            
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.button3 = new System.Windows.Forms.Button();
                this.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.textBox7 = new System.Windows.Forms.TextBox();
                this.textBox8 = new System.Windows.Forms.TextBox();
                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.label7 = new System.Windows.Forms.Label();
                this.label8 = new System.Windows.Forms.Label();
                this.textBox9 = new System.Windows.Forms.TextBox();
                this.label9 = new System.Windows.Forms.Label();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.BackColor = System.Drawing.SystemColors.Info;
                this.button1.Location = new System.Drawing.Point(75, 372);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(128, 41);
                this.button1.TabIndex = 0;
                this.button1.Text = "确定";
                this.button1.UseVisualStyleBackColor = false;
                this.button1.Click += new System.EventHandler(this.button1_Click_1);
                // 
                // button2
                // 
                this.button2.BackColor = System.Drawing.SystemColors.Info;
                this.button2.Location = new System.Drawing.Point(264, 371);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(140, 41);
                this.button2.TabIndex = 1;
                this.button2.Text = "修改";
                this.button2.UseVisualStyleBackColor = false;
                this.button2.Click += new System.EventHandler(this.button2_Click_1);
                // 
                // button3
                // 
                this.button3.BackColor = System.Drawing.SystemColors.Info;
                this.button3.Location = new System.Drawing.Point(479, 372);
                this.button3.Name = "button3";
                this.button3.Size = new System.Drawing.Size(136, 40);
                this.button3.TabIndex = 2;
                this.button3.Text = "退出";
                this.button3.UseVisualStyleBackColor = false;
                this.button3.Click += new System.EventHandler(this.button3_Click_1);
                // 
                // textBox1
                // 
                this.textBox1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox1.Location = new System.Drawing.Point(94, 46);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(155, 25);
                this.textBox1.TabIndex = 3;
                // 
                // textBox2
                // 
                this.textBox2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox2.Location = new System.Drawing.Point(94, 96);
                this.textBox2.Name = "textBox2";
                this.textBox2.Size = new System.Drawing.Size(155, 25);
                this.textBox2.TabIndex = 4;
                // 
                // textBox3
                // 
                this.textBox3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox3.Location = new System.Drawing.Point(436, 46);
                this.textBox3.Name = "textBox3";
                this.textBox3.Size = new System.Drawing.Size(130, 25);
                this.textBox3.TabIndex = 5;
                // 
                // textBox4
                // 
                this.textBox4.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox4.Location = new System.Drawing.Point(94, 209);
                this.textBox4.Name = "textBox4";
                this.textBox4.Size = new System.Drawing.Size(100, 25);
                this.textBox4.TabIndex = 6;
                // 
                // textBox5
                // 
                this.textBox5.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox5.Location = new System.Drawing.Point(304, 209);
                this.textBox5.Name = "textBox5";
                this.textBox5.Size = new System.Drawing.Size(100, 25);
                this.textBox5.TabIndex = 7;
                // 
                // textBox6
                // 
                this.textBox6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox6.Location = new System.Drawing.Point(500, 276);
                this.textBox6.Name = "textBox6";
                this.textBox6.Size = new System.Drawing.Size(100, 25);
                this.textBox6.TabIndex = 8;
                // 
                // textBox7
                // 
                this.textBox7.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox7.Location = new System.Drawing.Point(500, 209);
                this.textBox7.Name = "textBox7";
                this.textBox7.Size = new System.Drawing.Size(100, 25);
                this.textBox7.TabIndex = 9;
                // 
                // textBox8
                // 
                this.textBox8.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox8.Location = new System.Drawing.Point(94, 276);
                this.textBox8.Name = "textBox8";
                this.textBox8.Size = new System.Drawing.Size(100, 25);
                this.textBox8.TabIndex = 10;
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(51, 99);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(37, 15);
                this.label1.TabIndex = 11;
                this.label1.Text = "班级";
                // 
                // label2
                // 
                this.label2.AutoSize = true;
                this.label2.ForeColor = System.Drawing.Color.Blue;
                this.label2.Location = new System.Drawing.Point(393, 49);
                this.label2.Name = "label2";
                this.label2.Size = new System.Drawing.Size(37, 15);
                this.label2.TabIndex = 12;
                this.label2.Text = "姓名";
                // 
                // label3
                // 
                this.label3.AutoSize = true;
                this.label3.Location = new System.Drawing.Point(51, 219);
                this.label3.Name = "label3";
                this.label3.Size = new System.Drawing.Size(37, 15);
                this.label3.TabIndex = 13;
                this.label3.Text = "语文";
                this.label3.Click += new System.EventHandler(this.label3_Click);
                // 
                // label4
                // 
                this.label4.AutoSize = true;
                this.label4.Location = new System.Drawing.Point(261, 212);
                this.label4.Name = "label4";
                this.label4.Size = new System.Drawing.Size(37, 15);
                this.label4.TabIndex = 14;
                this.label4.Text = "数学";
                this.label4.Click += new System.EventHandler(this.label4_Click);
                // 
                // label5
                // 
                this.label5.AutoSize = true;
                this.label5.Location = new System.Drawing.Point(457, 278);
                this.label5.Name = "label5";
                this.label5.Size = new System.Drawing.Size(37, 15);
                this.label5.TabIndex = 15;
                this.label5.Text = "体育";
                this.label5.Click += new System.EventHandler(this.label5_Click);
                // 
                // label6
                // 
                this.label6.AutoSize = true;
                this.label6.Location = new System.Drawing.Point(457, 212);
                this.label6.Name = "label6";
                this.label6.Size = new System.Drawing.Size(37, 15);
                this.label6.TabIndex = 16;
                this.label6.Text = "英语";
                this.label6.Click += new System.EventHandler(this.label6_Click);
                // 
                // label7
                // 
                this.label7.AutoSize = true;
                this.label7.Location = new System.Drawing.Point(51, 278);
                this.label7.Name = "label7";
                this.label7.Size = new System.Drawing.Size(37, 15);
                this.label7.TabIndex = 17;
                this.label7.Text = "物理";
                this.label7.Click += new System.EventHandler(this.label7_Click);
                // 
                // label8
                // 
                this.label8.AutoSize = true;
                this.label8.Location = new System.Drawing.Point(51, 46);
                this.label8.Name = "label8";
                this.label8.Size = new System.Drawing.Size(37, 15);
                this.label8.TabIndex = 18;
                this.label8.Text = "学号";
                // 
                // textBox9
                // 
                this.textBox9.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox9.Location = new System.Drawing.Point(304, 278);
                this.textBox9.Name = "textBox9";
                this.textBox9.Size = new System.Drawing.Size(100, 25);
                this.textBox9.TabIndex = 19;
                // 
                // label9
                // 
                this.label9.AutoSize = true;
                this.label9.Location = new System.Drawing.Point(261, 279);
                this.label9.Name = "label9";
                this.label9.Size = new System.Drawing.Size(37, 15);
                this.label9.TabIndex = 20;
                this.label9.Text = "政治";
                // 
                // ChangeStuForm
                // 
                this.BackColor = System.Drawing.SystemColors.InactiveCaption;
                this.ClientSize = new System.Drawing.Size(719, 478);
                this.Controls.Add(this.label9);
                this.Controls.Add(this.textBox9);
                this.Controls.Add(this.label8);
                this.Controls.Add(this.label7);
                this.Controls.Add(this.label6);
                this.Controls.Add(this.label5);
                this.Controls.Add(this.label4);
                this.Controls.Add(this.label3);
                this.Controls.Add(this.label2);
                this.Controls.Add(this.label1);
                this.Controls.Add(this.textBox8);
                this.Controls.Add(this.textBox7);
                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.button3);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.ForeColor = System.Drawing.Color.Blue;
                this.Name = "ChangeStuForm";
                this.Text = "修改";
                this.Load += new System.EventHandler(this.ChangeStuForm_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            private void button1_Click_1(object sender, EventArgs e)
            {
                //遍历查找
                Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                cur = PublicValue.Head;//从头开始查找
                int findId = int.Parse(textBox1.Text);
                while (cur != null)
                {
                    if (cur.id == findId)
                    {
                        textBox2.Text = cur.classnum;
                        textBox3.Text = cur.name;
                        textBox4.Text = Convert.ToString(cur.c_sharp);
                        textBox5.Text = Convert.ToString(cur.ds);
                        textBox6.Text = Convert.ToString(cur.maogai);
                        textBox7.Text = Convert.ToString(cur.ps);
                        textBox8.Text = Convert.ToString(cur.sports);
                        break;
                    }
                    cur = cur.Next;
                }
                if (cur == null)
                {
                    MessageBox.Show("你输入的学号不存在!");
                }
            }
    
            private void button2_Click_1(object sender, EventArgs e)
            {
                //再次遍历查找
                Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                cur = PublicValue.Head;//从头开始查找
                int findId = int.Parse(textBox1.Text);
                while (cur != null)
                {
                    if (cur.id == findId)
                    {
                        cur.classnum = textBox2.Text;
                        cur.name = textBox3.Text;
                        cur.c_sharp = int.Parse(textBox4.Text);
                        cur.ds = int.Parse(textBox5.Text);
                        cur.maogai = int.Parse(textBox6.Text);
                        cur.ps = int.Parse(textBox7.Text);
                        cur.sports = int.Parse(textBox8.Text);
                        cur.total = cur.c_sharp + cur.ds + cur.maogai + cur.ps + cur.sports;
                        cur.average = cur.total / 5;
    
                        MessageBox.Show("修改成功");
                        break;
                    }
                    cur = cur.Next;
                }
                if (cur == null)
                {
                    MessageBox.Show("修改失败,你输入的学号不存在!请不要改变刚才输入的学号");
                }
            }
    
            private void button3_Click_1(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void label7_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label4_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label6_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label3_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label5_Click(object sender, EventArgs e)
            {
    
            }
    
            private void ChangeStuForm_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    

    *******************************
    看到这里休息一下吧
    ***************
    4.添加

    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 C_sharp学生成绩管理系统
    {
        public partial class AddStuForm : Form
        {
            private Button button1;
            private Button button2;
            private Button button3;
            private TextBox textBox1;
            private TextBox textBox2;
            private TextBox textBox3;
            private TextBox textBox4;
            private TextBox textBox5;
            private TextBox textBox6;
            private TextBox textBox7;
            private TextBox textBox8;
            private Label label1;
            private Label label2;
            private Label label3;
            private Label label4;
            private Label label5;
            private Label label6;
            private Label label7;
            private TextBox textBox9;
            private Label label9;
            private Label label8;
    
            public AddStuForm()
            {
                InitializeComponent();
            }
    
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.button3 = new System.Windows.Forms.Button();
                this.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.textBox7 = new System.Windows.Forms.TextBox();
                this.textBox8 = new System.Windows.Forms.TextBox();
                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.label7 = new System.Windows.Forms.Label();
                this.label8 = new System.Windows.Forms.Label();
                this.textBox9 = new System.Windows.Forms.TextBox();
                this.label9 = new System.Windows.Forms.Label();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.BackColor = System.Drawing.SystemColors.Info;
                this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
                this.button1.Location = new System.Drawing.Point(34, 369);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(131, 43);
                this.button1.TabIndex = 0;
                this.button1.Text = "添加";
                this.button1.UseVisualStyleBackColor = false;
                this.button1.Click += new System.EventHandler(this.button1_Click_1);
                // 
                // button2
                // 
                this.button2.BackColor = System.Drawing.SystemColors.Info;
                this.button2.Location = new System.Drawing.Point(235, 369);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(122, 43);
                this.button2.TabIndex = 1;
                this.button2.Text = "自动添加";
                this.button2.UseVisualStyleBackColor = false;
                this.button2.Click += new System.EventHandler(this.button2_Click_1);
                // 
                // button3
                // 
                this.button3.BackColor = System.Drawing.SystemColors.Info;
                this.button3.Location = new System.Drawing.Point(445, 369);
                this.button3.Name = "button3";
                this.button3.Size = new System.Drawing.Size(136, 43);
                this.button3.TabIndex = 2;
                this.button3.Text = "退出";
                this.button3.UseVisualStyleBackColor = false;
                this.button3.Click += new System.EventHandler(this.button3_Click_1);
                // 
                // textBox1
                // 
                this.textBox1.BackColor = System.Drawing.SystemColors.ControlLightLight;
                this.textBox1.Location = new System.Drawing.Point(101, 63);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(166, 25);
                this.textBox1.TabIndex = 3;
                // 
                // textBox2
                // 
                this.textBox2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox2.Location = new System.Drawing.Point(376, 66);
                this.textBox2.Name = "textBox2";
                this.textBox2.Size = new System.Drawing.Size(144, 25);
                this.textBox2.TabIndex = 4;
                this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
                // 
                // textBox3
                // 
                this.textBox3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox3.Location = new System.Drawing.Point(101, 119);
                this.textBox3.Name = "textBox3";
                this.textBox3.Size = new System.Drawing.Size(166, 25);
                this.textBox3.TabIndex = 5;
                // 
                // textBox4
                // 
                this.textBox4.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox4.Location = new System.Drawing.Point(70, 217);
                this.textBox4.Name = "textBox4";
                this.textBox4.Size = new System.Drawing.Size(100, 25);
                this.textBox4.TabIndex = 6;
                // 
                // textBox5
                // 
                this.textBox5.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox5.Location = new System.Drawing.Point(282, 279);
                this.textBox5.Name = "textBox5";
                this.textBox5.Size = new System.Drawing.Size(100, 25);
                this.textBox5.TabIndex = 7;
                // 
                // textBox6
                // 
                this.textBox6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox6.Location = new System.Drawing.Point(282, 217);
                this.textBox6.Name = "textBox6";
                this.textBox6.Size = new System.Drawing.Size(100, 25);
                this.textBox6.TabIndex = 8;
                // 
                // textBox7
                // 
                this.textBox7.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox7.Location = new System.Drawing.Point(497, 217);
                this.textBox7.Name = "textBox7";
                this.textBox7.Size = new System.Drawing.Size(100, 25);
                this.textBox7.TabIndex = 9;
                // 
                // textBox8
                // 
                this.textBox8.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox8.Location = new System.Drawing.Point(74, 279);
                this.textBox8.Name = "textBox8";
                this.textBox8.Size = new System.Drawing.Size(100, 25);
                this.textBox8.TabIndex = 10;
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(49, 63);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(37, 15);
                this.label1.TabIndex = 11;
                this.label1.Text = "学号";
                // 
                // label2
                // 
                this.label2.AutoSize = true;
                this.label2.Location = new System.Drawing.Point(313, 69);
                this.label2.Name = "label2";
                this.label2.Size = new System.Drawing.Size(37, 15);
                this.label2.TabIndex = 12;
                this.label2.Text = "姓名";
                // 
                // label3
                // 
                this.label3.AutoSize = true;
                this.label3.Location = new System.Drawing.Point(49, 129);
                this.label3.Name = "label3";
                this.label3.Size = new System.Drawing.Size(37, 15);
                this.label3.TabIndex = 13;
                this.label3.Text = "班级";
                // 
                // label4
                // 
                this.label4.AutoSize = true;
                this.label4.Location = new System.Drawing.Point(31, 220);
                this.label4.Name = "label4";
                this.label4.Size = new System.Drawing.Size(37, 15);
                this.label4.TabIndex = 14;
                this.label4.Text = "语文";
                this.label4.Click += new System.EventHandler(this.label4_Click);
                // 
                // label5
                // 
                this.label5.AutoSize = true;
                this.label5.Location = new System.Drawing.Point(442, 289);
                this.label5.Name = "label5";
                this.label5.Size = new System.Drawing.Size(37, 15);
                this.label5.TabIndex = 15;
                this.label5.Text = "体育";
                this.label5.Click += new System.EventHandler(this.label5_Click);
                // 
                // label6
                // 
                this.label6.AutoSize = true;
                this.label6.Location = new System.Drawing.Point(232, 217);
                this.label6.Name = "label6";
                this.label6.Size = new System.Drawing.Size(37, 15);
                this.label6.TabIndex = 16;
                this.label6.Text = "数学";
                this.label6.Click += new System.EventHandler(this.label6_Click);
                // 
                // label7
                // 
                this.label7.AutoSize = true;
                this.label7.Location = new System.Drawing.Point(442, 220);
                this.label7.Name = "label7";
                this.label7.Size = new System.Drawing.Size(37, 15);
                this.label7.TabIndex = 17;
                this.label7.Text = "英语";
                this.label7.Click += new System.EventHandler(this.label7_Click);
                // 
                // label8
                // 
                this.label8.AutoSize = true;
                this.label8.Location = new System.Drawing.Point(31, 289);
                this.label8.Name = "label8";
                this.label8.Size = new System.Drawing.Size(37, 15);
                this.label8.TabIndex = 18;
                this.label8.Text = "物理";
                this.label8.Click += new System.EventHandler(this.label8_Click);
                // 
                // textBox9
                // 
                this.textBox9.BackColor = System.Drawing.SystemColors.ButtonHighlight;
                this.textBox9.Location = new System.Drawing.Point(497, 286);
                this.textBox9.Name = "textBox9";
                this.textBox9.Size = new System.Drawing.Size(100, 25);
                this.textBox9.TabIndex = 19;
                // 
                // label9
                // 
                this.label9.AutoSize = true;
                this.label9.Location = new System.Drawing.Point(232, 279);
                this.label9.Name = "label9";
                this.label9.Size = new System.Drawing.Size(37, 15);
                this.label9.TabIndex = 20;
                this.label9.Text = "政治";
                // 
                // AddStuForm
                // 
                this.BackColor = System.Drawing.SystemColors.InactiveCaption;
                this.ClientSize = new System.Drawing.Size(655, 484);
                this.Controls.Add(this.label9);
                this.Controls.Add(this.textBox9);
                this.Controls.Add(this.label8);
                this.Controls.Add(this.label7);
                this.Controls.Add(this.label6);
                this.Controls.Add(this.label5);
                this.Controls.Add(this.label4);
                this.Controls.Add(this.label3);
                this.Controls.Add(this.label2);
                this.Controls.Add(this.label1);
                this.Controls.Add(this.textBox8);
                this.Controls.Add(this.textBox7);
                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.button3);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.ForeColor = System.Drawing.Color.Blue;
                this.Name = "AddStuForm";
                this.Text = "添加";
                this.Load += new System.EventHandler(this.AddStuForm_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            private void button1_Click_1(object sender, EventArgs e)
            {
                //临时接收
                int id;
                string name;
                string classnum;
    
                //分数
                int c_sharp;
                int ds;
                int maogai;
                int ps;
                int sports;
    
                id = int.Parse(textBox1.Text);
                name = textBox2.Text;
                classnum = textBox3.Text;
                c_sharp = int.Parse(textBox4.Text);
                ds = int.Parse(textBox5.Text);
                maogai = int.Parse(textBox6.Text);
                ps = int.Parse(textBox7.Text);
                sports = int.Parse(textBox8.Text);
    
                LinkList.Append(id, name, classnum, c_sharp, ds, maogai, ps, sports);
                PublicValue.total++;
                MessageBox.Show("添加成功");
            }
    
            private void button2_Click_1(object sender, EventArgs e)
            {
                Random rd = new Random();
    
                if (Convert.ToString(textBox1.Text) == "")
                {
                    textBox1.Text = Convert.ToString(1);
                }
                else
                {
                    textBox1.Text = Convert.ToString(1 + int.Parse(textBox1.Text));//学号自动顺延
                }
    
                textBox2.Text = "张三";
                textBox3.Text = "计算机科学与技术1班";
    
                textBox4.Text = Convert.ToString(rd.Next(50, 100));
                textBox5.Text = Convert.ToString(rd.Next(50, 100));
                textBox6.Text = Convert.ToString(rd.Next(50, 100));
                textBox7.Text = Convert.ToString(rd.Next(50, 100));
                textBox8.Text = Convert.ToString(rd.Next(50, 100));
            }
    
            private void button3_Click_1(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void textBox2_TextChanged(object sender, EventArgs e)
            {
    
            }
    
            private void label4_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label6_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label7_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label5_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label8_Click(object sender, EventArgs e)
            {
    
            }
    
            private void AddStuForm_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    

    5.删除

    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 C_sharp学生成绩管理系统
    {
        public partial class DelStuForm : Form
        {
            private Button button1;
            private Button button2;
            private Label label1;
            private Label label2;
            private TextBox textBox1;
            private TextBox textBox2;
            private Button button3;
    
            public DelStuForm()
            {
                InitializeComponent();
            }
    
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.button3 = new System.Windows.Forms.Button();
                this.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();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.BackColor = System.Drawing.SystemColors.Info;
                this.button1.Location = new System.Drawing.Point(393, 58);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(103, 39);
                this.button1.TabIndex = 0;
                this.button1.Text = "查找";
                this.button1.UseVisualStyleBackColor = false;
                this.button1.Click += new System.EventHandler(this.button1_Click_1);
                // 
                // button2
                // 
                this.button2.BackColor = System.Drawing.SystemColors.Info;
                this.button2.Location = new System.Drawing.Point(410, 425);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(121, 46);
                this.button2.TabIndex = 1;
                this.button2.Text = "删除";
                this.button2.UseVisualStyleBackColor = false;
                this.button2.Click += new System.EventHandler(this.button2_Click_1);
                // 
                // button3
                // 
                this.button3.BackColor = System.Drawing.SystemColors.Info;
                this.button3.Location = new System.Drawing.Point(594, 425);
                this.button3.Name = "button3";
                this.button3.Size = new System.Drawing.Size(93, 46);
                this.button3.TabIndex = 2;
                this.button3.Text = "退出";
                this.button3.UseVisualStyleBackColor = false;
                this.button3.Click += new System.EventHandler(this.button3_Click_1);
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(44, 58);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(37, 15);
                this.label1.TabIndex = 3;
                this.label1.Text = "学号";
                // 
                // label2
                // 
                this.label2.AutoSize = true;
                this.label2.Location = new System.Drawing.Point(44, 127);
                this.label2.Name = "label2";
                this.label2.Size = new System.Drawing.Size(37, 15);
                this.label2.TabIndex = 4;
                this.label2.Text = "信息";
                // 
                // textBox1
                // 
                this.textBox1.BackColor = System.Drawing.Color.Snow;
                this.textBox1.Location = new System.Drawing.Point(96, 58);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(206, 25);
                this.textBox1.TabIndex = 5;
                // 
                // textBox2
                // 
                this.textBox2.BackColor = System.Drawing.Color.SeaShell;
                this.textBox2.Location = new System.Drawing.Point(96, 124);
                this.textBox2.Multiline = true;
                this.textBox2.Name = "textBox2";
                this.textBox2.Size = new System.Drawing.Size(591, 281);
                this.textBox2.TabIndex = 6;
                // 
                // DelStuForm
                // 
                this.BackColor = System.Drawing.SystemColors.InactiveCaption;
                this.ClientSize = new System.Drawing.Size(783, 483);
                this.Controls.Add(this.textBox2);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.label2);
                this.Controls.Add(this.label1);
                this.Controls.Add(this.button3);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.ForeColor = System.Drawing.Color.Blue;
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
                this.Name = "DelStuForm";
                this.Text = "删除";
                this.Load += new System.EventHandler(this.DelStuForm_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            private void button1_Click_1(object sender, EventArgs e)
            {
                Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                cur = PublicValue.Head;
    
                textBox2.Text = "";//先清空
                textBox2.Text += "学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\r\n";
    
                int findId = int.Parse(textBox1.Text);
                while (cur != null)
                {
                    if (cur.id == findId)
                    {
                        textBox2.Text += cur.id + "\t";
                        textBox2.Text += cur.classnum + "\t";
                        textBox2.Text += cur.name + "\t";
                        textBox2.Text += cur.c_sharp + "\t";
                        textBox2.Text += cur.ds + "\t"+"\t";
                        textBox2.Text += cur.maogai + "\t";
                        textBox2.Text += cur.ps + "\t";
                        textBox2.Text += cur.sports;
                        break;
                    }
                    cur = cur.Next;
                }
                if (cur == null)
                {
                    MessageBox.Show("你输入的学号不存在!");
                }
            }
    
            private void button2_Click_1(object sender, EventArgs e)
            {
                Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//大哥
                Node last = new Node(0, "0", "0", 0, 0, 0, 0, 0);//小弟
    
                cur = PublicValue.Head;
                last = cur;
    
                int findId = int.Parse(textBox1.Text);
    
                //查找
                while (cur != null)
                {
                    if (cur.id == findId)//如果找到了
                    {
                        PublicValue.total--;
    
                        if (cur == PublicValue.Head)//如果删除的是头节点
                        {
                            PublicValue.Head = PublicValue.Head.Next;
                            MessageBox.Show("删除成功");
                            return;
                        }
                        else
                        {
                            last.Next = cur.Next;//垃圾回收机制,不需要自己清理内存
                            MessageBox.Show("删除成功");
                            return;
                        }
                    }
                    last = cur;//小弟踩大哥脚印
                    cur = cur.Next;//大哥先走一步
                }
    
                if (cur == null)
                {
                    MessageBox.Show("你删除的学号不存在!");
                }
    
            }
    
            private void button3_Click_1(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void DelStuForm_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    

    6.排序

    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 C_sharp学生成绩管理系统
    {
        public partial class SortForm : Form
        {
            private Button button1;
            private Button button2;
            private Button button3;
            private Button button4;
            private Button button5;
            private TextBox textBox1;
            private Label label1;
            private ComboBox comboBox1;
    
            public SortForm()
            {
                InitializeComponent();
            }
    
    
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.button3 = new System.Windows.Forms.Button();
                this.button4 = new System.Windows.Forms.Button();
                this.button5 = new System.Windows.Forms.Button();
                this.comboBox1 = new System.Windows.Forms.ComboBox();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.label1 = new System.Windows.Forms.Label();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.BackColor = System.Drawing.SystemColors.Info;
                this.button1.Location = new System.Drawing.Point(614, 12);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(112, 44);
                this.button1.TabIndex = 0;
                this.button1.Text = "按课程排序";
                this.button1.UseVisualStyleBackColor = false;
                this.button1.Click += new System.EventHandler(this.button1_Click_1);
                // 
                // button2
                // 
                this.button2.BackColor = System.Drawing.SystemColors.Info;
                this.button2.Location = new System.Drawing.Point(39, 12);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(108, 44);
                this.button2.TabIndex = 1;
                this.button2.Text = "按班级排序";
                this.button2.UseVisualStyleBackColor = false;
                this.button2.Click += new System.EventHandler(this.button2_Click_1);
                // 
                // button3
                // 
                this.button3.BackColor = System.Drawing.SystemColors.Info;
                this.button3.Location = new System.Drawing.Point(424, 12);
                this.button3.Name = "button3";
                this.button3.Size = new System.Drawing.Size(93, 44);
                this.button3.TabIndex = 2;
                this.button3.Text = "按总分排序";
                this.button3.UseVisualStyleBackColor = false;
                this.button3.Click += new System.EventHandler(this.button3_Click_1);
                // 
                // button4
                // 
                this.button4.BackColor = System.Drawing.SystemColors.Info;
                this.button4.Location = new System.Drawing.Point(662, 358);
                this.button4.Name = "button4";
                this.button4.Size = new System.Drawing.Size(119, 44);
                this.button4.TabIndex = 3;
                this.button4.Text = "退出";
                this.button4.UseVisualStyleBackColor = false;
                this.button4.Click += new System.EventHandler(this.button4_Click_1);
                // 
                // button5
                // 
                this.button5.BackColor = System.Drawing.SystemColors.Info;
                this.button5.Location = new System.Drawing.Point(221, 12);
                this.button5.Name = "button5";
                this.button5.Size = new System.Drawing.Size(95, 44);
                this.button5.TabIndex = 4;
                this.button5.Text = "按学号排序";
                this.button5.UseVisualStyleBackColor = false;
                this.button5.Click += new System.EventHandler(this.button5_Click_1);
                // 
                // comboBox1
                // 
                this.comboBox1.BackColor = System.Drawing.Color.WhiteSmoke;
                this.comboBox1.ForeColor = System.Drawing.Color.MediumPurple;
                this.comboBox1.FormattingEnabled = true;
                this.comboBox1.Items.AddRange(new object[] {
                "语文",
                "数学",
                "英语",
                "物理",
                "政治",
                "体育"});
                this.comboBox1.Location = new System.Drawing.Point(614, 62);
                this.comboBox1.Name = "comboBox1";
                this.comboBox1.Size = new System.Drawing.Size(121, 20);
                this.comboBox1.TabIndex = 5;
                // 
                // textBox1
                // 
                this.textBox1.BackColor = System.Drawing.Color.White;
                this.textBox1.Location = new System.Drawing.Point(87, 117);
                this.textBox1.Multiline = true;
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(519, 224);
                this.textBox1.TabIndex = 6;
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(36, 117);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(29, 12);
                this.label1.TabIndex = 7;
                this.label1.Text = "信息";
                // 
                // SortForm
                // 
                this.BackColor = System.Drawing.SystemColors.InactiveCaption;
                this.ClientSize = new System.Drawing.Size(848, 533);
                this.Controls.Add(this.label1);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.comboBox1);
                this.Controls.Add(this.button5);
                this.Controls.Add(this.button4);
                this.Controls.Add(this.button3);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.ForeColor = System.Drawing.Color.Blue;
                this.Name = "SortForm";
                this.Text = "排序";
                this.Load += new System.EventHandler(this.SortForm_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            private void button1_Click_1(object sender, EventArgs e)
            {
                Node temp = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                Node left = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node right = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node rightmin = new Node(0, "0", "0", 0, 0, 0, 0, 0);
    
                left = PublicValue.Head;
                right = PublicValue.Head;
    
                if (left == null)
                {
                    MessageBox.Show("无法排序,请先存入数据");
                }
                else
                {
                    for (; left != null; left = left.Next)//最大的数放在左边
                    {
                        right = left;
                        for (rightmin = right; right != null; right = right.Next)//从右边找出最小的数,用prightmax记录其位置
                        {
                            if (right.id < rightmin.id)
                            {
                                rightmin = right;
                            }
                        }
    
                        temp.id = rightmin.id;
                        temp.name = rightmin.name;
                        temp.classnum = rightmin.classnum;
                        temp.c_sharp = rightmin.c_sharp;
                        temp.ds = rightmin.ds;
                        temp.maogai = rightmin.maogai;
                        temp.ps = rightmin.ps;
                        temp.sports = rightmin.sports;
                        temp.total = rightmin.total;//补充
                        temp.average = rightmin.average;//补充
    
                        rightmin.id = left.id;
                        rightmin.name = left.name;
                        rightmin.classnum = left.classnum;
                        rightmin.c_sharp = left.c_sharp;
                        rightmin.ds = left.ds;
                        rightmin.maogai = left.maogai;
                        rightmin.ps = left.ps;
                        rightmin.sports = left.sports;
                        rightmin.total = left.total;//补充
                        rightmin.average = left.average;//补充
    
    
                        left.id = temp.id;
                        left.name = temp.name;
                        left.classnum = temp.classnum;
                        left.c_sharp = temp.c_sharp;
                        left.ds = temp.ds;
                        left.maogai = temp.maogai;
                        left.ps = temp.ps;
                        left.sports = temp.sports;
                        left.total = temp.total;//补充
                        left.average = temp.average;//补充
                    }
    
                    //输出
                    MessageBox.Show("排序成功");
                    Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
    
                    textBox1.Text = "";//先清空
                    textBox1.Text += "学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\t总分\t平均分\r\n";
    
                    cur = PublicValue.Head;
    
                    while (cur != null)
                    {
                        textBox1.Text += cur.id + "\t" + cur.classnum + "\t" + cur.name + "\t" + cur.c_sharp + "\t" + cur.ds + "\t" + "\t" + cur.maogai + "\t" + cur.ps + "\t" + "\t" + cur.sports + "\t" + cur.total + "\t" + cur.average.ToString("f2") + "\r\n";
                        cur = cur.Next;
                    }
                }
            }
    
            private void button2_Click_1(object sender, EventArgs e)
            {
                Node temp = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                Node left = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node right = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node rightmin = new Node(0, "0", "0", 0, 0, 0, 0, 0);
    
                left = PublicValue.Head;
                right = PublicValue.Head;
    
                if (left == null)
                {
                    MessageBox.Show("无法排序,请先存入数据");
                }
                else
                {
                    for (; left != null; left = left.Next)//最大的数放在左边
                    {
                        right = left;
                        for (rightmin = right; right != null; right = right.Next)//从右边找出最小的数,用prightmax记录其位置
                        {
                            if (right.classnum.CompareTo(rightmin.classnum) < 0)
                            {
                                rightmin = right;
                            }
                        }
    
                        temp.id = rightmin.id;
                        temp.name = rightmin.name;
                        temp.classnum = rightmin.classnum;
                        temp.c_sharp = rightmin.c_sharp;
                        temp.ds = rightmin.ds;
                        temp.maogai = rightmin.maogai;
                        temp.ps = rightmin.ps;
                        temp.sports = rightmin.sports;
                        temp.total = rightmin.total;//补充
                        temp.average = rightmin.average;//补充
    
                        rightmin.id = left.id;
                        rightmin.name = left.name;
                        rightmin.classnum = left.classnum;
                        rightmin.c_sharp = left.c_sharp;
                        rightmin.ds = left.ds;
                        rightmin.maogai = left.maogai;
                        rightmin.ps = left.ps;
                        rightmin.sports = left.sports;
                        rightmin.total = left.total;//补充
                        rightmin.average = left.average;//补充
    
    
                        left.id = temp.id;
                        left.name = temp.name;
                        left.classnum = temp.classnum;
                        left.c_sharp = temp.c_sharp;
                        left.ds = temp.ds;
                        left.maogai = temp.maogai;
                        left.ps = temp.ps;
                        left.sports = temp.sports;
                        left.total = temp.total;//补充
                        left.average = temp.average;//补充
                    }
    
                    //输出
                    MessageBox.Show("排序成功");
                    Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
    
                    textBox1.Text = "";//先清空
                    textBox1.Text += "学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\t总分\t平均分\r\n";
    
                    cur = PublicValue.Head;
    
                    while (cur != null)
                    {
                        textBox1.Text += cur.id + "\t" + cur.classnum + "\t" + cur.name + "\t" + cur.c_sharp + "\t" + cur.ds + "\t" + "\t" + cur.maogai + "\t" + cur.ps + "\t" + "\t" + cur.sports + "\t" + cur.total + "\t" + cur.average.ToString("f2") + "\r\n";
                        cur = cur.Next;
                    }
                }
            }
    
            private void button3_Click_1(object sender, EventArgs e)
            {
                Node temp = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                Node left = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node right = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node rightmin = new Node(0, "0", "0", 0, 0, 0, 0, 0);
    
                left = PublicValue.Head;
                right = PublicValue.Head;
    
                if (left == null)
                {
                    MessageBox.Show("无法排序,请先存入数据");
                }
                else
                {
                    for (; left != null; left = left.Next)//最大的数放在左边
                    {
                        right = left;
                        for (rightmin = right; right != null; right = right.Next)//从右边找出最小的数,用prightmax记录其位置
                        {
                            if (right.total > rightmin.total)//从大到小 其他排序方式只改这一行即可
                            {
                                rightmin = right;
                            }
                        }
    
                        temp.id = rightmin.id;
                        temp.name = rightmin.name;
                        temp.classnum = rightmin.classnum;
                        temp.c_sharp = rightmin.c_sharp;
                        temp.ds = rightmin.ds;
                        temp.maogai = rightmin.maogai;
                        temp.ps = rightmin.ps;
                        temp.sports = rightmin.sports;
                        temp.total = rightmin.total;//补充
                        temp.average = rightmin.average;//补充
    
                        rightmin.id = left.id;
                        rightmin.name = left.name;
                        rightmin.classnum = left.classnum;
                        rightmin.c_sharp = left.c_sharp;
                        rightmin.ds = left.ds;
                        rightmin.maogai = left.maogai;
                        rightmin.ps = left.ps;
                        rightmin.sports = left.sports;
                        rightmin.total = left.total;//补充
                        rightmin.average = left.average;//补充
    
    
                        left.id = temp.id;
                        left.name = temp.name;
                        left.classnum = temp.classnum;
                        left.c_sharp = temp.c_sharp;
                        left.ds = temp.ds;
                        left.maogai = temp.maogai;
                        left.ps = temp.ps;
                        left.sports = temp.sports;
                        left.total = temp.total;//补充
                        left.average = temp.average;//补充
                    }
    
                    //输出
                    MessageBox.Show("排序成功");
                    Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
    
                    textBox1.Text = "";//先清空
                    textBox1.Text += "学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\t总分\t平均分\r\n";
    
                    cur = PublicValue.Head;
    
                    while (cur != null)
                    {
                        textBox1.Text += cur.id + "\t" + cur.classnum + "\t" + cur.name + "\t" + cur.c_sharp + "\t" + cur.ds + "\t" + "\t" + cur.maogai + "\t" + cur.ps + "\t" + "\t" + cur.sports + "\t" + cur.total + "\t" + cur.average.ToString("f2") + "\r\n";
                        cur = cur.Next;
                    }
                }
            }
    
            private void button4_Click_1(object sender, EventArgs e)
            {
                this.Close();
            }
    
            private void button5_Click_1(object sender, EventArgs e)
            {
    
                int choose = -1;//
    
                if (comboBox1.Text == "语文") choose = 0;
                else if (comboBox1.Text == "体育") choose = 1;
                else if (comboBox1.Text == "数学") choose = 2;
                else if (comboBox1.Text == "英语") choose = 3;
                else if (comboBox1.Text == "物理") choose = 4;
    
                //排序
                Node temp = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                Node left = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node right = new Node(0, "0", "0", 0, 0, 0, 0, 0);
                Node rightmin = new Node(0, "0", "0", 0, 0, 0, 0, 0);
    
                left = PublicValue.Head;
                right = PublicValue.Head;
    
                if (left == null)
                {
                    MessageBox.Show("无法排序,请先存入数据");
                }
                else
                {
                    for (; left != null; left = left.Next)//最大的数放在左边
                    {
                        right = left;
                        for (rightmin = right; right != null; right = right.Next)//从右边找出最小的数,用prightmax记录其位置
                        {
                            switch (choose)
                            {
                                case -1:
                                    MessageBox.Show("出错了!choose=-1 没有选择");
                                    break;
                                case 0:
                                    if (right.c_sharp > rightmin.c_sharp)//从大到小
                                    {
                                        rightmin = right;
                                    }
                                    break;
                                case 1:
                                    if (right.ds > rightmin.ds)//从大到小
                                    {
                                        rightmin = right;
                                    }
                                    break;
                                case 2:
                                    if (right.maogai > rightmin.maogai)//从大到小
                                    {
                                        rightmin = right;
                                    }
                                    break;
                                case 3:
                                    if (right.ps > rightmin.ps)//从大到小
                                    {
                                        rightmin = right;
                                    }
                                    break;
                                case 4:
                                    if (right.sports > rightmin.sports)//从大到小
                                    {
                                        rightmin = right;
                                    }
                                    break;
                            }
    
                        }
    
    
                        temp.id = rightmin.id;
                        temp.name = rightmin.name;
                        temp.classnum = rightmin.classnum;
                        temp.c_sharp = rightmin.c_sharp;
                        temp.ds = rightmin.ds;
                        temp.maogai = rightmin.maogai;
                        temp.ps = rightmin.ps;
                        temp.sports = rightmin.sports;
                        temp.total = rightmin.total;//补充
                        temp.average = rightmin.average;//补充
    
                        rightmin.id = left.id;
                        rightmin.name = left.name;
                        rightmin.classnum = left.classnum;
                        rightmin.c_sharp = left.c_sharp;
                        rightmin.ds = left.ds;
                        rightmin.maogai = left.maogai;
                        rightmin.ps = left.ps;
                        rightmin.sports = left.sports;
                        rightmin.total = left.total;//补充
                        rightmin.average = left.average;//补充
    
    
                        left.id = temp.id;
                        left.name = temp.name;
                        left.classnum = temp.classnum;
                        left.c_sharp = temp.c_sharp;
                        left.ds = temp.ds;
                        left.maogai = temp.maogai;
                        left.ps = temp.ps;
                        left.sports = temp.sports;
                        left.total = temp.total;//补充
                        left.average = temp.average;//补充
                    }
    
                    //输出
                    MessageBox.Show("排序成功");
                    Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
    
                    textBox1.Text = "";//先清空
                    textBox1.Text += "学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\t总分\t平均分\r\n";
    
                    cur = PublicValue.Head;
    
                    while (cur != null)
                    {
                        textBox1.Text += cur.id + "\t" + cur.classnum + "\t" + cur.name + "\t" + cur.c_sharp + "\t" + cur.ds + "\t" + "\t" + cur.maogai + "\t" + cur.ps + "\t" + "\t" + cur.sports + "\t" + cur.total + "\t" + cur.average.ToString("f2") + "\r\n";
                        cur = cur.Next;
                    }
                }
    
            }
    
            private void SortForm_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    

    7.查找

    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 C_sharp学生成绩管理系统
    {
        public partial class FindForm : Form
        {
            private Button button1;
            private TextBox textBox1;
            private TextBox textBox2;
            private Label label1;
            private Label label2;
            private Button button2;
            
            public FindForm()
            {
                InitializeComponent();
            }
            private void button1_Click_1(object sender, EventArgs e)
            {
                this.Close();
            }
           
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.textBox2 = new System.Windows.Forms.TextBox();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.label1 = new System.Windows.Forms.Label();
                this.label2 = new System.Windows.Forms.Label();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.BackColor = System.Drawing.SystemColors.Info;
                this.button1.Location = new System.Drawing.Point(561, 386);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(98, 51);
                this.button1.TabIndex = 0;
                this.button1.Text = "退出";
                this.button1.UseVisualStyleBackColor = false;
                this.button1.Click += new System.EventHandler(this.button1_Click_1);
                // 
                // button2
                // 
                this.button2.BackColor = System.Drawing.SystemColors.Info;
                this.button2.Location = new System.Drawing.Point(309, 31);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(115, 40);
                this.button2.TabIndex = 1;
                this.button2.Text = "查找";
                this.button2.UseVisualStyleBackColor = false;
                this.button2.Click += new System.EventHandler(this.button2_Click_1);
                // 
                // textBox2
                // 
                this.textBox2.BackColor = System.Drawing.Color.Snow;
                this.textBox2.Location = new System.Drawing.Point(103, 99);
                this.textBox2.Multiline = true;
                this.textBox2.Name = "textBox2";
                this.textBox2.Size = new System.Drawing.Size(556, 261);
                this.textBox2.TabIndex = 2;
                // 
                // textBox1
                // 
                this.textBox1.BackColor = System.Drawing.Color.Snow;
                this.textBox1.Location = new System.Drawing.Point(103, 38);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(168, 25);
                this.textBox1.TabIndex = 3;
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(39, 38);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(37, 15);
                this.label1.TabIndex = 4;
                this.label1.Text = "学号";
                // 
                // label2
                // 
                this.label2.AutoSize = true;
                this.label2.Location = new System.Drawing.Point(39, 102);
                this.label2.Name = "label2";
                this.label2.Size = new System.Drawing.Size(37, 15);
                this.label2.TabIndex = 5;
                this.label2.Text = "信息";
                // 
                // FindForm
                // 
                this.BackColor = System.Drawing.SystemColors.InactiveCaption;
                this.ClientSize = new System.Drawing.Size(739, 449);
                this.Controls.Add(this.label2);
                this.Controls.Add(this.label1);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.textBox2);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.ForeColor = System.Drawing.Color.Blue;
                this.Name = "FindForm";
                this.Text = "查找";
                this.Load += new System.EventHandler(this.FindForm_Load);
                this.ResumeLayout(false);
                this.PerformLayout();
    
            }
    
            private void button2_Click_1(object sender, EventArgs e)
            {
                Node cur = new Node(0, "0", "0", 0, 0, 0, 0, 0);//毫无意义的赋值
                cur = PublicValue.Head;
                int findId = int.Parse(textBox1.Text);
                textBox2.Text = "";//先清空
                textBox2.Text += "学号 \t\t 班级 \t\t姓名\t语文\t体育\t数学\t英语\t物理\t总分\t平均分\r\n";
    
             
    
                while (cur != null)
                {
                    if (cur.id == findId)
                    {
                        textBox2.Text += cur.id + "\t";
                        textBox2.Text += cur.classnum + "\t";
                        textBox2.Text += cur.name + "\t";
                        textBox2.Text += cur.c_sharp + "\t";
                        textBox2.Text += cur.ds + "\t" + "\t";
                        textBox2.Text += cur.maogai + "\t";
                        textBox2.Text += cur.ps + "\t";
                        textBox2.Text += cur.sports + "\t";
                        textBox2.Text += cur.total + "\t";
                        textBox2.Text += cur.average.ToString("f2");
                        break;
                    }
                    cur = cur.Next;
                }
                if (cur == null)
                {
                    MessageBox.Show("你输入的学号不存在!");
                }
            }
    
            private void FindForm_Load(object sender, EventArgs e)
            {
    
            }
        }
    }
    

    ==那么先恭喜看到这里的亲,你已经快要胜利了,666. 长时间地做和用眼对身体不好,请缓解一下自己的疲劳。==看着以下图片缓解一下吧。

    在这里插入图片描述
    没办法,码农的生活就是这么枯燥且乏味,为了自己的目标和学习、工作努力有什么不值得呢。
    为了方便大家做出来,我提供了每一块的代码和控件属性表给大家,链接如下:
    链接:https://pan.baidu.com/s/1T8VV4jX0G9wxV3QIJgOCkA
    提取码:zuyc

    运行结果

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里说明一下,可能运行出来的信息界面不太规则排列,大家可以去自行更改。

    行百里者半九十,坚持练习,就会有长足的进步。加油!
    博主整理不易,还请大家多多指正,转载请注明出处。如果对你的学习有帮助的话请留下你那个大大的赞,你的支持与关注就是博主最大的更新动力。

    本期博文如果反响比较好的话,我会在评论区发放源代码链接,也请大家在评论区多多留言,谢谢大家的支持与鼓励

    C# 下期预告:
    1.简易计算器的实现
    2.C#核心语法
    3.俄罗斯方块的设计与编写
    本期源代码文件链接:
    链接:https://pan.baidu.com/s/16CJzZ_2GsmjO-fypOpgNHA
    提取码:y72z

    展开全文
  • C# windows窗体应用程序设计 本系列最后一篇,以后不会再以博文的方式呈现。 文章目录C# windows窗体应用程序设计前言一、俄罗斯方块的实现二、步骤1.部分函数代码2.说明(分析代码时会用到)3.好的,展示完毕4....
  • 精通 C#与.NET4.0 数据库开发 实验报告 实验题目 Windows 窗体程序的开发 专 业 计算机科学与技术 学 生 姓 名 班 级 学 号 教 师 指 导 单 位 日 期 教 师 评 教师签名 年 月 日 语 成 绩 评 定 备 注 一实验目的 1...
  • Windows窗体应用程序设计 ;窗体设计 ; 窗体类型 在C#中窗体分为如下两种类型 1普通窗体也称为单文档窗体SDI前面所有创建的窗体均为普通窗体普通窗体又分为如下两种 模式窗体这类窗体在屏幕上显示后用户必须响应只有...
  • C# WinForm 编程需要创建「Windows窗体应用程序」项目。 .NET 提供了大量 Windows 风格的控件和事件,我们可以直接拿来使用,上手简单,开发快速。 Windows 窗体应用程序是 C# 语言中的一个重要应用,也是 C# 语言最...
  • C# 做的WINDOWS窗体程序-简易计算器

    热门讨论 2015-01-06 10:38:19
    用C#做的一个简单的实现加减乘除的WINDOWS窗体程序计算器
  • c# Windows窗体应用程序设计(三)

    千次阅读 多人点赞 2020-04-20 11:09:41
    c# Windows窗体应用程序设计(三) 今天继续来更新基础的应用,综合设计小游戏正在整理中。通过这样的方式一来是反复巩固自己所学的东西,二是为了让想学习编程的小白或者编程爱好者能简单的上手应用制作一些窗体。 ...
  • c# Windows窗体应用程序设计(四)

    千次阅读 多人点赞 2020-04-21 10:52:17
    c# Windows窗体应用程序设计(四) 上次介绍的简单应用其中第二个窗体运行结果如下: 我相信肯定有比我做得更好的小伙伴,关于上次第二个窗体设计有疑问的可以在下方留言,欢迎讨论。 今天来介绍两个简单应用,树...
  • 数据结构课程设计,用C++/CLR语言编写的Windows窗体应用程序,简易计算器。程序设计还是大二的时候学的,当时老师教的特别好。
  • Windows窗体还提供了基于Visual Studio中提供的可视设计器创建桌面应用程序的最有效方法之一。 它可以拖放可视控件和其他类似功能,从而使构建桌面应用程序变得容易。 Windows窗体设计器 有关设计器的更多信息,请...
  • WinForm程序设计 窗体;WinForm程序设计什么是窗;WinForm程序设计窗体的概;WinForm程序设计WinF;WinForm程序设计创建Wi;设计窗口;各种控件放置控件的区域属性Wi;WinForm程序设计解决方案;static class Pr;WinForm程序...
  • c# Windows窗体应用程序设计(二)

    千次阅读 多人点赞 2020-04-19 20:07:26
    c# Windows窗体应用程序设计(二) 今天分享2个部分,分别是上下文菜单窗体和单选框、复选框窗体。 1.上下文菜单窗体 1.先新建一个名为上下文菜单窗体(名字自己随便定)的窗体应用程序,将窗体 Text属性设为“上...
  • 我正在用.Net C#开发一个客户端服务器应用程序,其中我需要将所有送入服务器窗口的数据存储到一个文件中。 数据是从各种控件中选择的,例如下拉菜单,文本框等。 我不知道该怎么做。任何帮助将不胜感激...谢谢!!...
  • c# Windows窗体应用程序设计(五)

    千次阅读 2020-04-23 16:09:03
    c# Windows窗体应用程序设计(五) 本次来介绍时钟控件、日历控件和MDI窗口。 1.时钟控件和日历控件 1.新建项目 1.新建一个名为时钟和日历控件的项目,再将Name属性改为FormCalendar。 2.添加控件 所要添加的控件及...
  • c# Windows窗体应用程序设计综合实例(一)匹配游戏设计 上次的计时器运行效果图如下: = ------------------------------------------------------------------------------ 今天来分享一个综合实例,设计一个匹配...
  • Windows窗口程序设计入门(C#版)

    千次阅读 多人点赞 2018-05-05 13:13:04
    这次用C#写个简单的窗口程序,这篇文章完全是面向新手的。我简单说明一下我们要实现的功能:有两个窗体Form1和Form2,这两个窗体里面都有一个TextBox和一个Button。①当单击Form1里面的Button时,加载出Form2,同时...
  • 一款用Visual C#编写的计算器,基本功能全部实现了
  • 第8章 Windows窗体应用 在C#中Windows窗体应用程序也是面向对象编程技术的一个重要组成部分窗体中所有...8.1 Windows窗体简介 开发Windows窗体应用程序最首要的工具就是窗体设计器通过它程序设计人员可以开发出各种形式
  • VC#_Windows窗体应用程序—计算器

    万次阅读 多人点赞 2018-10-28 16:03:31
    Windows窗体应用程序的计算器编写

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 47,886
精华内容 19,154
关键字:

windows窗体程序设计