Beispiel #1
0
        /// <summary>
        /// Hàm tạo giao diện sản phẩm
        /// </summary>
        /// <param name="tabProducts">Tab để hiển thị hình ảnh</param>
        /// <param name="listProduct">Danh sách sản phẩm</param>
        private void createProducts(tabNews tabProducts, List <SanPham> listProduct)
        {
            Point pointOld = new Point(15, 20);
            int   newLine  = 0;

            for (int i = 0; i < listProduct.Count; i++)
            {
                SanPham           u       = listProduct[i];
                tabProductSamples product = new tabProductSamples(u)
                {
                    Location = pointOld,
                };
                product.setOnClickListener(this);
                newLine++;
                if (newLine > 3)
                {
                    newLine  = 0;
                    pointOld = new Point(15, pointOld.Y + 360);
                }
                else
                {
                    pointOld = new Point(pointOld.X + 250, pointOld.Y);
                }
                tabProducts.Controls.Add(product);
            }
        }