//Make the game be owned /* internal void beOwned() * { * Owned = true; * initiateGamePage(); * }*/ private void chekGameInfo() { if (FAM.checkGameInfo(RegisteredGame)) { this.GameDescriptionBox.DataSource = FAM.getGameDescription(RegisteredGame); this.GamePictureBox.BackgroundImage = FAM.getGameImage(RegisteredGame); this.GamePictureBox.BackgroundImageLayout = ImageLayout.Stretch; } else { FAM.generateGameInfo(RegisteredGame); this.GameDescriptionBox.DataSource = FAM.getGameDescription(RegisteredGame); this.GamePictureBox.BackgroundImage = FAM.getGameImage(RegisteredGame); this.GamePictureBox.BackgroundImageLayout = ImageLayout.Stretch; } }
//Make Panels private void GamePanels(Panel parentPanel, List <Game> gamelibrary) { //starting positions int panelheight = 60; int edgepad = 20; parentPanel.Controls.Clear(); //loop this thing for (int i = 0; i < gamelibrary.Count; i++) { //items in the label Bitmap gameImage; //Generate Game Info FileAccessModule FAM = new FileAccessModule(); if (FAM.checkGameInfo(gamelibrary[i])) { gameImage = FAM.getGameImage(gamelibrary[i]); } else { FAM.generateGameInfo(gamelibrary[i]); gameImage = FAM.getGameImage(gamelibrary[i]); } // //items in the label Panel gameFrame = new Panel(); //holds everthing PictureBox gamePicture = new PictureBox(); Label gameTitle = new Label(); Label gameStudio = new Label(); Label gameRating = new Label(); Label gameSold = new Label(); Label gamePrice = new Label(); //Label gameGenre = new Label(); //make the labels gameFrame.Size = new Size(parentPanel.Size.Width - edgepad, panelheight); //length of the entire panel, and then the height gameFrame.Location = new Point(0, (i * (panelheight + 2))); gameFrame.Margin = new Padding(0); gameFrame.Padding = new Padding(0); gameFrame.Name = StoreLibrary.FindIndex(a => a.GameID.Equals(gamelibrary[i].GameID)).ToString(); gameFrame.BackColor = Color.FromArgb(10, 18, 29); gameFrame.DoubleClick += CustomItem_DoubleClick; gameFrame.MouseHover += CustomItem_Hover; gameFrame.MouseLeave += CustomItem_MouseLeave; gamePicture.Size = new Size(gameFrame.Size.Height, gameFrame.Size.Height); //makes it a box using the workframe width, this makes a box gamePicture.BackColor = Color.FromArgb(50, 255, 255, 255); gamePicture.BackgroundImage = gameImage; gamePicture.BackgroundImageLayout = ImageLayout.Stretch; gameTitle.Text = (i + 1) + ". " + gamelibrary[i].Name; gameTitle.AutoSize = true; gameFrame.Controls.Add(gameTitle); //add it in so the size resizes gameTitle.Font = new Font(this.Font.FontFamily, 10, FontStyle.Underline); gameTitle.Location = new Point(gamePicture.Location.X + gamePicture.Width, 5); gameTitle.ForeColor = Color.FromArgb(255, 255, 255); gameTitle.BackColor = Color.FromArgb(0); /* gameTitle.MouseHover += Label_MouseHover; * gameTitle.MouseLeave += Label_MouseLeave;*/ gameStudio.Text = gamelibrary[i].Studio + "\n" + gamelibrary[i].Genre; gameStudio.AutoSize = true; gameFrame.Controls.Add(gameStudio); //add it in so the size resizes gameStudio.Font = new Font(this.Font.FontFamily, 8); gameStudio.Location = new Point((gameTitle.Location.X), (gameTitle.Location.Y + gameTitle.Size.Height)); gameStudio.ForeColor = Color.FromArgb(255, 255, 255); gameStudio.BackColor = Color.FromArgb(0); /* gameStudio.MouseHover += Label_MouseHover; * gameStudio.MouseLeave += Label_MouseLeave;*/ gameRating.Text = "rating: " + gamelibrary[i].Ratings + "%"; gameRating.AutoSize = true; gameFrame.Controls.Add(gameRating); //add it in so the size resizes gameRating.Font = new Font(this.Font.FontFamily, 8); gameRating.Location = new Point((gameFrame.Location.X + gamePicture.Size.Width), (gameFrame.Size.Height - gameRating.Size.Height)); gameRating.ForeColor = Color.FromArgb(255, 255, 255); gameRating.BackColor = Color.FromArgb(0); gameSold.Text = gamelibrary[i].ItemSold + " units sold"; gameSold.AutoSize = true; gameFrame.Controls.Add(gameSold); //add it in so the size resizes gameSold.Font = new Font(this.Font.FontFamily, 8); gameSold.Location = new Point((gameFrame.Location.X + (gameFrame.Size.Width / 2)) - (0), (gameFrame.Size.Height - gameRating.Size.Height)); gameSold.ForeColor = Color.FromArgb(255, 255, 255); gameSold.BackColor = Color.FromArgb(0); gamePrice.Text = "$" + gamelibrary[i].Price; gamePrice.AutoSize = true; gameFrame.Controls.Add(gamePrice); //add it in so the size resizes gamePrice.Location = new Point((gameFrame.Location.X + gameFrame.Size.Width) - (gamePrice.Size.Width), (gameFrame.Size.Height - gamePrice.Size.Height)); gamePrice.Font = new Font(this.Font.FontFamily, 8); gamePrice.ForeColor = Color.FromArgb(255, 255, 255); gamePrice.BackColor = Color.FromArgb(0); gameFrame.Controls.Add(gamePicture); //update Location parentPanel.Controls.Add(gameFrame); } // hide the scroll bar Panel hidePanel = new Panel(); hidePanel.Size = new Size(edgepad, parentPanel.Height); hidePanel.Location = new Point((parentPanel.Location.X + parentPanel.Size.Width) - hidePanel.Size.Width, parentPanel.Location.Y); hidePanel.BackColor = this.BackColor; hidePanel.Name = "HideScroll"; parentPanel.AutoScroll = true; parentPanel.VerticalScroll.Visible = false; parentPanel.HorizontalScroll.Visible = false; this.Controls.Add(hidePanel); hidePanel.BringToFront(); }