示例#1
0
        //Hiển thị danh sách điện thoại
        private void ShowPhone(List <SmartPhone> list)
        {
            int row   = (list.Count / 3) + 1;
            int y     = 0;
            int index = 0;

            for (int i = 0; i < row; i++)
            {
                int x = 0;
                for (int j = 0; j < 3; j++)
                {
                    if (index <= list.Count - 1)
                    {
                        PhoneShow phone = new PhoneShow();
                        phone.Location = new Point(x, y);
                        phone.Controls["NameButton1"].Text            = list[index].TenDienThoai;
                        phone.Controls["PriceButton1"].Text           = list[index].Gia + " VNĐ";
                        phone.Controls["pictureBox1"].BackgroundImage = Image.FromFile(PhonePicturePath + list[index].TenDienThoai + ".PNG");
                        phone1.Controls.Add(phone);
                        x += 210;
                    }
                    index++;
                }
                y += 270;
            }
        }
示例#2
0
        private void Phone2_Load()
        {
            //Khởi tạo danh sách điện thoại
            // dùng lại màn hình phone2 này để lọc và show lên màn hình sau khi dùng chức năng tư vấn
            List <SmartPhone> list = this.PhoneList;
            int row   = (list.Count / 3) + 1;
            int y     = 0;
            int index = 0;

            for (int i = 0; i < row; i++)
            {
                int x = 0;
                for (int j = 0; j < 3; j++)
                {
                    if (index <= list.Count - 1)
                    {
                        PhoneShow phone = new PhoneShow();
                        phone.Location = new Point(x, y);
                        phone.Controls["NameButton1"].Text            = list[index].TenDienThoai;
                        phone.Controls["PriceButton1"].Text           = list[index].Gia + " VNĐ";
                        phone.Controls["pictureBox1"].BackgroundImage = Image.FromFile(PhonePicturePath + list[index].TenDienThoai + ".PNG");
                        phone2.Controls.Add(phone);
                        x += 210;
                    }
                    index++;
                }
                y += 270;
            }
        }
示例#3
0
        private void MyApp_Load(object sender, EventArgs e)
        {
            //đọc thông tin điện thoại
            LoadSmartPhoneInfo();

            //load thông tin điện thoại ra màn hình
            phone1.BringToFront();
            {
                int row   = (PhoneList.Count / 3) + 1;
                int y     = 0;
                int index = 0;
                for (int i = 0; i < row; i++)
                {
                    int x = 0;
                    for (int j = 0; j < 3; j++)
                    {
                        if (index <= PhoneList.Count - 1)
                        {
                            PhoneShow phone = new PhoneShow();
                            phone.Location = new Point(x, y);
                            phone.Controls["NameButton1"].Text  = PhoneList[index].TenDienThoai;
                            phone.Controls["PriceButton1"].Text = PhoneList[index].Gia + " VNĐ";
                            phone1.Controls.Add(phone);
                            phone.BringToFront();
                            x += 210;
                        }
                        index++;
                    }
                    y += 270;
                }
            }
        }
示例#4
0
        //show điện thoại từ kết quả tư vấn
        protected void PhoneInterenceResult(HashSet <String> InferenceList)
        {
            List <String> list = InferenceList.ToList();
            //MessageBox.Show(string.Join(",", InferenceList));
            int row   = (list.Count / 3) + 1;
            int y     = 0;
            int Count = 0;

            for (int i = 0; i < row; i++)
            {
                int x = 0;
                for (int j = 0; j < 3; j++)
                {
                    if (Count <= list.Count - 1)
                    {
                        int index = 0;
                        foreach (SmartPhone Phone in PhoneList)
                        {
                            if (Phone.TenDienThoai == list[Count])
                            {
                                break;
                            }
                            index++;
                        }
                        PhoneShow phone = new PhoneShow();
                        phone.Location = new Point(x, y);
                        phone.Controls["NameButton1"].Text            = PhoneList[index].TenDienThoai;
                        phone.Controls["PriceButton1"].Text           = PhoneList[index].Gia + " VNĐ";
                        phone.Controls["pictureBox1"].BackgroundImage = Image.FromFile(PhonePicturePath + PhoneList[index].TenDienThoai + ".PNG");
                        phone2.Controls.Add(phone);
                        x += 210;
                    }
                    Count++;
                }
                y += 270;
            }
            phone2.Visible = true;
            phone2.BringToFront();
        }
示例#5
0
        //Hiển thị danh sách điện thoại
        private void ShowPhone(List <SmartPhone> list)
        {
            int   row        = (list.Count / 5) + 1;
            Label phoneCount = new Label();

            phoneCount.Name      = "phoneCount";
            phoneCount.Text      = list.Count.ToString() + " Điện thoại";
            phoneCount.AutoSize  = true;
            phoneCount.Location  = new Point(390, 20);
            phoneCount.ForeColor = Color.FromArgb(255, 128, 0);
            phoneCount.Font      = new Font("Microsoft Sans Serif", 11, FontStyle.Regular);
            panel2.Controls.Add(phoneCount);
            int y     = 50;
            int index = 0;

            for (int i = 0; i < row; i++)
            {
                int x = 0;
                for (int j = 0; j < 5; j++)
                {
                    if (index <= list.Count - 1)
                    {
                        PhoneShow phone = new PhoneShow();
                        phone.Location = new Point(x, y);
                        phone.Controls["NameButton1"].Text            = list[index].TenDienThoai;
                        phone.Controls["PriceButton1"].Text           = list[index].Gia + " VNĐ";
                        phone.Controls["pictureBox1"].BackgroundImage = Image.FromFile(PhonePicturePath + list[index].TenDienThoai + ".PNG");
                        phone.Controls["label1"].Hide();
                        phone1.Controls.Add(phone);
                        x += 210;
                    }
                    index++;
                }
                y += 270;
            }
        }