zoukankan      html  css  js  c++  java
  • 关于【项目经理评分】项目的代码分析

    class Class1
    {

    public String id { get; set; }
    public string name { get; set; }
    public string age { get; set; }
    public string PF { get; set; }
    public string score { get; set; }
    public static Class1[] array =new Class1[5];

    }

    --一个辅助类,并设置一个静态的数组,长度为5

    public void S()
    {
    listView1.Items.Clear();
    for (int i = 0; i < 2; i++)
    {
    ListViewItem l = new ListViewItem(Class1.array[i].id);
    l.SubItems.Add(Class1.array[i].name);
    l.SubItems.Add(Class1.array[i].age);
    l.SubItems.Add(Class1.array[i].PF);
    l.SubItems.Add(Class1.array[i].score);

    listView1.Items.Add(l);
    }
    }

    --循环添加到listview的方法,方法名为:S

    private void Form1_Load(object sender, EventArgs e)
    {
    Class1 c = new Class1();
    c.id = "1";
    c.name = "小智";
    c.PF = "未评分";
    c.score = "0";
    Class1.array[0] = c;
    Class1 c1 = new Class1();
    c1.id = "2";
    c1.name = "小小智";
    c1.PF = "未评分";
    c1.score = "0";
    Class1.array[1] = c1;
    S();
    }

    --窗体load事件中给数组赋值并调用添加到listview的方法S

    private void listView1_DoubleClick(object sender, EventArgs e)
    {

    Form2 f = new Form2();
    f.a = listView1.SelectedItems[0].SubItems[1].Text;
    f.b = listView1.SelectedItems[0].SubItems[3].Text;
    f.c = listView1.SelectedItems[0].SubItems[4].Text;
    f.Owner = this;
    f.Show();

    }

    --当listview双击后的事件,把值传递给Form2 并Show这个窗体

    public string a, b,c;
    private void Form2_Load(object sender, EventArgs e)
    {
    textBox1.Text = a;
    textBox2.Text = b;
    textBox3.Text = c;
    }

    --用变量接受Form1传递得到的值,并给textBox赋值

    private void button1_Click(object sender, EventArgs e)
    {
    for (int i = 0; i < 5; i++)
    {
    if (Class1.array[i].name==a)
    {
    Class1.array[i].PF = textBox2.Text;
    Class1.array[i].score = textBox3.Text;
    break;
    }
    }
    Form1 f;
    f = (Form1)this.Owner;
    f.S();

    }

    --改变数组的值并及时刷新Form1的窗体

  • 相关阅读:
    jenkins任务
    追涨手段
    识别上升浪中的假反弹假阻力
    上升浪的判断
    点位超过10的上涨高位转折点
    纯碱下跌巨幅捕捉
    纯碱规律
    玉米
    iOS基础之界面通信
    iOS基础之UINavigationController(导航视图控制器)
  • 原文地址:https://www.cnblogs.com/wyd12138/p/5806583.html
Copyright © 2011-2022 走看看