Esempio n. 1
0
        public HomePanel(CartPanel cartRef, StorePanel storeRef)
        {
            cartPanelRef  = cartRef;
            storePanelRef = storeRef;

            // Create this.tablelayoutpanel with three rows and three columns.
            #region HomePanels details about rows, columns etc.
            this.Dock        = DockStyle.Fill;
            this.Margin      = new Padding(0);
            this.ColumnCount = 3;
            this.RowCount    = 3;
            this.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33));
            this.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33));
            this.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33));
            this.RowStyles.Add(new RowStyle(SizeType.Percent, 10));
            this.RowStyles.Add(new RowStyle(SizeType.Percent, 20));
            this.RowStyles.Add(new RowStyle(SizeType.Percent, 70));
            Label topThree = new Label
            {
                Text      = "Topp tre kategorier och deras populäraste produkter.",
                Font      = new Font("Calibri", 13, FontStyle.Bold),
                Dock      = DockStyle.Fill,
                TextAlign = ContentAlignment.MiddleCenter,
            };
            this.SetColumnSpan(topThree, 3);
            this.Controls.Add(topThree);
            #endregion

            PopulateHomePanelList();
            PopulateHomePanel();
        }
Esempio n. 2
0
        public StorePanel(CartPanel reference)
        {
            cartPanelRef = reference;

            base.leftPanel.RowCount = 3;
            base.leftPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 30));
            base.leftPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 20));
            base.leftPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 35));

            CreateTypeList();
            CreateTypePanel();
            PopulateTypePanel(typeList);
        }
Esempio n. 3
0
        public MyForm()
        {
            this.MinimumSize = new Size(800, 500);
            this.Font        = new Font("Calibri", 12);
            this.FormClosed += MyForm_IsClosed;

            TableLayoutPanel mainPanel = new TableLayoutPanel
            {
                RowCount        = 2,
                Dock            = DockStyle.Fill,
                CellBorderStyle = TableLayoutPanelCellBorderStyle.Single,
                Padding         = new Padding(0),
            };

            mainPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 100));
            mainPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50));
            this.Controls.Add(mainPanel);

            TableLayoutPanel topPanel = new TableLayoutPanel
            {
                ColumnCount     = 3,
                Dock            = DockStyle.Fill,
                CellBorderStyle = TableLayoutPanelCellBorderStyle.Single,
                BackColor       = Color.White,
                Margin          = new Padding(0),
            };

            topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 100));
            topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30));
            topPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 100));
            mainPanel.Controls.Add(topPanel);

            Button storeButton = new Button
            {
                Name                  = "Store",
                BackgroundImage       = Image.FromFile("Icons/store.png"),
                BackgroundImageLayout = ImageLayout.Zoom,
                Dock                  = DockStyle.Fill,
                Margin                = new Padding(0)
            };

            storeButton.Click += ViewChangedButton_Click;
            topPanel.Controls.Add(storeButton);

            PictureBox headerPicture = new PictureBox
            {
                Dock        = DockStyle.Fill,
                Image       = Image.FromFile("Background/Header1.jpg"),
                SizeMode    = PictureBoxSizeMode.StretchImage,
                BorderStyle = BorderStyle.Fixed3D,
            };

            headerPicture.Click += HeaderPicture_Click;
            topPanel.Controls.Add(headerPicture);

            Button cartButton = new Button
            {
                Name                  = "Cart",
                BackgroundImage       = Image.FromFile("Icons/cart.png"),
                BackgroundImageLayout = ImageLayout.Zoom,
                Dock                  = DockStyle.Fill,
                Margin                = new Padding(0)
            };

            cartButton.Click += ViewChangedButton_Click;
            topPanel.Controls.Add(cartButton);

            cart  = new CartPanel();
            store = new StorePanel(cart);

            // Send store as parameter to homePanel to connect them so we
            // can display clicked product in the descriptionPanel in storePanel.
            home = new HomePanel(cart, store);

            mainPanel.Controls.Add(store, 0, 1);
            mainPanel.Controls.Add(cart, 0, 1);
            mainPanel.Controls.Add(home, 0, 1);
            cart.Hide();
            store.Hide();
            home.Select();
            store.PopulateStorePanel(cart.GetProductList());
        }