예제 #1
0
        private void assign_Prop(animals an, string type, string species,
                                 int p1, int p2, int p3, int p4, int p5,
                                 int p6, int p7, int p8, int p9)
        {
            an.Type    = type;
            an.Species = species;
            an.PROP_1  = p1;
            an.PROP_2  = p2;
            an.PROP_3  = p3;
            an.PROP_4  = p4;
            an.PROP_5  = p5;
            an.PROP_6  = p6;
            an.PROP_7  = p7;
            an.PROP_8  = p8;
            an.PROP_9  = p9;
            category.Add(an);
            string[] data = new string[] { an.Type,
                                           an.Species,
                                           an.PROP_1 + "",
                                           an.PROP_2 + "",
                                           an.PROP_3 + "",
                                           an.PROP_4 + "",
                                           an.PROP_5 + "",
                                           an.PROP_6 + "",
                                           an.PROP_7 + "",
                                           an.PROP_8 + "",
                                           an.PROP_9 + "" };
            ListViewItem set = new ListViewItem(data);

            listView1.Items.Add(set);
        }
예제 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            anList = new animals[7];

            for (int i = 0; i < 7; i++)
            {
                anList[i] = new animals();
            }
            myProp = new int[9];
            listView1.Columns.Add("ชนิด", 80);
            listView1.Columns.Add("สายพันธุ์", 105);
            listView1.Columns.Add("ออกลูกเป็นตัว", 80, HorizontalAlignment.Center);
            listView1.Columns.Add("ออกลูกเป็นไข่", 80, HorizontalAlignment.Center);
            listView1.Columns.Add("เลี้ยงลูกด้วยนม", 90, HorizontalAlignment.Center);
            listView1.Columns.Add("มีขนตามร่างกาย", 100, HorizontalAlignment.Center);
            listView1.Columns.Add("ผิวหยาบหรือเกล็ด", 100, HorizontalAlignment.Center);
            listView1.Columns.Add("สัตว์เลือดอุ่น", 80, HorizontalAlignment.Center);
            listView1.Columns.Add("สัตว์เลือดเย็น", 80, HorizontalAlignment.Center);
            listView1.Columns.Add("อยู่ทั้งในน้ำและบนบก", 120, HorizontalAlignment.Center);
            listView1.Columns.Add("หายใจด้วยเหงือก", 110, HorizontalAlignment.Center);

            assign_Prop(anList[0], "กบ", "สัตว์ครึ่งบกครึ่งน้ำ", 0, 1, 0, 0, 0, 0, 1, 1, 0);
            assign_Prop(anList[1], "ปลาหมอ", "สัตว์จำพวกปลา", 0, 1, 0, 0, 1, 0, 1, 0, 1);
            assign_Prop(anList[2], "จระเข้", "สัตว์เลื้อยคลาน", 0, 1, 0, 0, 1, 0, 1, 0, 0);
            assign_Prop(anList[3], "ปลาทอง", "สัตว์จำพวกปลา", 0, 0, 0, 0, 1, 0, 1, 0, 1);
            assign_Prop(anList[4], "เต่า", "สัตว์เลื้อยคลาน", 0, 1, 0, 0, 0, 0, 1, 0, 0);
            assign_Prop(anList[5], "สุนัข", "สัตว์เลี้ยงลูกด้วยนม", 1, 0, 1, 1, 0, 1, 0, 0, 0);
            assign_Prop(anList[6], "นกกระจอกเทศ", "สัตว์จำพวกนก", 1, 0, 0, 1, 0, 1, 0, 0, 0);
        }