Esempio n. 1
0
        public void create(Book propertiesofbook)
        {
            book             = propertiesofbook;
            this.Size        = new Size(165, 280);
            this.BackColor   = Color.Transparent;
            this.BorderStyle = BorderStyle.FixedSingle;

            PictureBox picture = new PictureBox();

            picture.Size     = new Size(80, 120);
            picture.SizeMode = PictureBoxSizeMode.StretchImage;
            picture.Location = new Point(40, 5);
            picture.Image    = propertiesofbook.Image;

            Label lblname = new Label();

            lblname.AutoSize  = false;
            lblname.Size      = new Size(165, 20);
            lblname.Font      = new System.Drawing.Font("Arial", 11f, System.Drawing.FontStyle.Bold);
            lblname.Location  = new System.Drawing.Point(0, 140);
            lblname.TextAlign = ContentAlignment.MiddleCenter;
            lblname.Text      = propertiesofbook.Name1;

            Label lblauthor = new Label();

            lblauthor.AutoSize  = false;
            lblauthor.Size      = new Size(165, 15);
            lblauthor.Font      = new System.Drawing.Font("Arial", 9f, System.Drawing.FontStyle.Regular);
            lblauthor.Location  = new System.Drawing.Point(0, 160);
            lblauthor.TextAlign = ContentAlignment.MiddleCenter;
            lblauthor.Text      = propertiesofbook.BookAuthor1;

            Label lblcategory = new Label();

            lblcategory.AutoSize  = false;
            lblcategory.Size      = new Size(165, 15);
            lblcategory.Location  = new System.Drawing.Point(0, 190);
            lblcategory.TextAlign = ContentAlignment.MiddleCenter;
            lblcategory.Text      = propertiesofbook.Category1;

            Label lblprice = new Label();

            lblprice.AutoSize  = false;
            lblprice.Size      = new Size(165, 15);
            lblprice.Font      = new System.Drawing.Font("Arial", 10f, System.Drawing.FontStyle.Regular);
            lblprice.Location  = new System.Drawing.Point(0, 210);
            lblprice.TextAlign = ContentAlignment.MiddleCenter;
            lblprice.Text      = propertiesofbook.Price1.ToString();

            Button btnaddcart = new Button();

            btnaddcart.Size      = new Size(100, 30);
            btnaddcart.BackColor = Color.WhiteSmoke;
            btnaddcart.FlatAppearance.BorderSize = 0;
            btnaddcart.FlatStyle = FlatStyle.Flat;
            btnaddcart.Location  = new System.Drawing.Point(15, 240);
            btnaddcart.Text      = " ADD CART ";
            btnaddcart.Font      = new Font("Arial", 10f, System.Drawing.FontStyle.Bold);
            btnaddcart.Click    += new EventHandler(AddCartClick);

            Button btndescription = new Button();

            btndescription.Size      = new Size(30, 30);
            btndescription.BackColor = Color.Transparent;
            btndescription.FlatStyle = FlatStyle.Flat;
            btndescription.FlatAppearance.BorderSize = 0;
            btndescription.Location   = new System.Drawing.Point(120, 240);
            btndescription.Image      = OnlineBookStore.Properties.Resources.open_book;
            btndescription.ImageAlign = ContentAlignment.MiddleCenter;
            btndescription.Click     += new EventHandler(ShowDescription);

            this.Controls.Add(picture);
            this.Controls.Add(lblname);
            this.Controls.Add(lblauthor);
            this.Controls.Add(lblcategory);
            this.Controls.Add(lblprice);
            this.Controls.Add(btnaddcart);
            this.Controls.Add(btndescription);
        }