コード例 #1
0
        private void showTheMost(string _strName, string _pathImage)
        {
            System.Drawing.Color col = System.Drawing.ColorTranslator.FromHtml("#179BD7");
            Label label = new Label()
            {
                ForeColor = col,
                Height    = 20,
                Width     = 100,
                Text      = _strName.Substring(7),
                TextAlign = ContentAlignment.TopCenter,
                Left      = 25,
                Margin    = this.Margin
            };
            var margin = label.Margin;

            margin.Left  = 25;
            label.Margin = margin;
            cImages images = new cImages();
            Button  btn;

            try
            {
                btn = new Button()
                {
                    Width  = 100,
                    Height = 100,
                    BackgroundImageLayout = ImageLayout.Stretch,

                    BackgroundImage = Image.FromFile(images.pathImagesPNG(_pathImage)),
                };
            }
            catch (Exception)
            {
                btn = new Button()
                {
                    Width  = 100,
                    Height = 100,
                    BackgroundImageLayout = ImageLayout.Stretch,

                    BackgroundImage = Image.FromFile(images.pathImagesJPG(_pathImage)),
                };
            }

            btn.Margin = margin;
            FlowLayoutPanel flowLayout = new FlowLayoutPanel()
            {
                Height = 165,
                Width  = 150,
            };

            flowLayout.Controls.Add(btn);
            flowLayout.Controls.Add(label);
            flpnlSanPhamBanChayNhat.Controls.Add(flowLayout);
        }
コード例 #2
0
        public void loadInfoSanPham(string _MaSP)
        {
            SanPhamBUS SPBUS = new SanPhamBUS();
            SANPHAM    SP    = SPBUS.loadInfoSanPhamToDB(_MaSP);

            lbMaSPInfo.Text     = SP.MASP.ToString();
            lbTenSPinfo.Text    = SP.TENSP.ToString();
            rtbChiTietInfo.Text = SP.THONGTIN.ToString();
            lbGiaInfo.Text      = String.Format("{0:n0} VNĐ", SP.GIABAN);
            cImages images = new cImages();

            images.Images(ptbInfoSanPham, SP.IMAGES);
        }