川哥哥

导航

窗体评分系统

namespace 项目
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            InitializeComponent();
        }
        public SE[] s = new SE[3];
        private void FrmMain_Load(object sender, EventArgs e)
        {
            Initial();
            Show();
        }
        //初始化数组
        public void Initial()
        {
            SE se = new SE("张三","100",18);
            SE se1 = new SE("李四", "100", 18);
            SE se2 = new SE("王五", "100", 18);
            s[0] = se;
            s[1] = se1;
            s[2] = se2;
        }
        //绑定LvName
        public void Show()
        {
            foreach (SE item in s)
            {
                ListViewItem list = new ListViewItem(item.id);
                list.SubItems.Add(item.name);
                list.SubItems.Add(item.age.ToString());
                list.SubItems.Add(item.pingjia);
                list.SubItems.Add(item.score.ToString());
                lvName.Items.Add(list);
            }
        }

        private void 评分ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmScore fs = new FrmScore();
            fs.lv = lvName.SelectedItems[0];
            fs.Show();
        }
    }

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 FrmScore : Form
    {
        public FrmScore()
        {
            InitializeComponent();
        }
        public ListViewItem lv;
        private void FrmScore_Load(object sender, EventArgs e)
        {
            txtName.Text = lv.SubItems[1].Text;
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
           
        }

        private void btnScore_Click(object sender, EventArgs e)
        {
            lv.SubItems[3].Text = txtPJ.Text;
            lv.SubItems[4].Text = txtScore.Text;
            this.Close();
        }

        private void btnQX_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

 

posted on 2016-08-25 13:58  川哥哥  阅读(232)  评论(0编辑  收藏  举报