public Panel bildThumbnailWatchPanel() { Panel output = new Panel(); output.Size = new System.Drawing.Size(thumbNailWatchWidth, thumbNailWatchHeight); output.BackColor = System.Drawing.Color.AntiqueWhite; output.Margin = new Padding(thumbNailPadding); PictureBox poster = new PictureBox(); //poster.BackColor = Color.AntiqueWhite; poster.Padding = new Padding(10); poster.Dock = DockStyle.Fill; poster.SizeMode = PictureBoxSizeMode.StretchImage; Image image = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/image-not-found.gif")); poster.Image = image; Label titleBox = new Label(); titleBox.Text = this.title; titleBox.Dock = DockStyle.Bottom; titleBox.TextAlign = ContentAlignment.MiddleCenter; Button BTNWatchList = new Button(); BTNWatchList.Dock = DockStyle.Bottom; BTNWatchList.AutoSize = true; BTNWatchList.FlatStyle = FlatStyle.Flat; BTNWatchList.BackColor = Color.LightSkyBlue; BTNWatchList.TextAlign = ContentAlignment.MiddleCenter; BTNWatchList.MouseClick += new MouseEventHandler(recItemAdd_MouseClick); DBConnect checker = new DBConnect(); if (!checker.inWatchList(MID, HomeForm.UID)) { BTNWatchList.Text = addTo; } else { BTNWatchList.Text = removeFrom; } output.Controls.Add(poster); output.Controls.Add(titleBox); output.Controls.Add(BTNWatchList); poster.Click += new EventHandler(clickedThumbNail); output.Click += new EventHandler(clickedThumbNail); titleBox.Click += new EventHandler(clickedThumbNail); return(output); }
public Panel bildThumbnailWatchPanel() { Panel output = new Panel(); output.Size = new System.Drawing.Size(thumbNailWatchWidth, thumbNailWatchHeight); output.BackColor = System.Drawing.Color.AntiqueWhite; output.Margin = new Padding(thumbNailPadding); PictureBox poster = new PictureBox(); //poster.BackColor = Color.AntiqueWhite; poster.Padding = new Padding(10); poster.Dock = DockStyle.Fill; poster.SizeMode = PictureBoxSizeMode.StretchImage; Image image = Image.FromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/image-not-found.gif")); poster.Image = image; Label titleBox = new Label(); titleBox.Text = this.title; titleBox.Dock = DockStyle.Bottom; titleBox.TextAlign = ContentAlignment.MiddleCenter; Button BTNWatchList = new Button(); BTNWatchList.Dock = DockStyle.Bottom; BTNWatchList.AutoSize = true; BTNWatchList.FlatStyle = FlatStyle.Flat; BTNWatchList.BackColor = Color.LightSkyBlue; BTNWatchList.TextAlign = ContentAlignment.MiddleCenter; BTNWatchList.MouseClick += new MouseEventHandler(recItemAdd_MouseClick); DBConnect checker = new DBConnect(); if (!checker.inWatchList(MID, HomeForm.UID)) BTNWatchList.Text = addTo; else BTNWatchList.Text = removeFrom; output.Controls.Add(poster); output.Controls.Add(titleBox); output.Controls.Add(BTNWatchList); poster.Click += new EventHandler(clickedThumbNail); output.Click += new EventHandler(clickedThumbNail); titleBox.Click += new EventHandler(clickedThumbNail); return output; }
public void changeToMoviePage(Movie theMovie) { currMovie = theMovie; DBConnect helper = new DBConnect(); movieRating = (int)helper.getUserRating(theMovie.getMID(), UID); // MessageBox.Show("Rating:" + movieRating.ToString()); userRated = true; if (movieRating == -1) { userRated = false; movieRating = (int)helper.AverageRating(theMovie.getMID()); } addBreadrumbs(this, theMovie.getTitle()); lblLocation.Text = theMovie.getTitle(); pnlContent.Controls.Clear(); //build new big panel pnlMovieInfo = new FlowLayoutPanel(); //pnlMovieInfo = new TableLayoutPanel(); //pnlMovieInfo.Anchor = AnchorStyles.Top; //pnlMovieInfo.Anchor = AnchorStyles.Bottom; //pnlMovieInfo.Anchor = AnchorStyles.Left; //pnlMovieInfo.Anchor = AnchorStyles.Right; //pnlMovieInfo.RowCount = 2; // pnlMovieInfo.ColumnCount = 1; pnlMovieInfo.BackColor = Color.SteelBlue; pnlMovieInfo.Dock = DockStyle.Fill; // this.pnlMovieInfo.RowStyles[0].Height = 50F; //this.pnlMovieInfo.RowStyles[1].Height = 50F; //this.pnlMovieInfo.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); pnlMovieInfo.FlowDirection = FlowDirection.TopDown; //Add Table panel to divide Movie thumbnail with info TableLayoutPanel pnlTopTable = new TableLayoutPanel(); //pnlTopTable.AutoSize = true; pnlTopTable.RowCount = 1; pnlTopTable.ColumnCount = 2; pnlTopTable.Padding = new Padding(0); pnlTopTable.Width = 1000; pnlTopTable.Height = 360; //pnlTopTable.Dock = DockStyle.Fill; pnlTopTable.BackColor = Color.SteelBlue; //Add left column contents FlowLayoutPanel leftCol = new FlowLayoutPanel(); leftCol.Padding = new Padding(0); leftCol.Dock = DockStyle.Fill; leftCol.FlowDirection = FlowDirection.TopDown; leftCol.Controls.Add(theMovie.buildThumbnailPanel()); //add thumbnails //Create area for ratings FlowLayoutPanel ratings = new FlowLayoutPanel(); ratings.Margin = new Padding(22, 0, 0, 0); //ratings.Height = 550; //ratings.Width = 550; ratings.FlowDirection = FlowDirection.LeftToRight; ratings.Padding = new Padding(0); ratings.BackColor = Color.SteelBlue; PictureBox oneStar = new PictureBox(); PictureBox twoStar = new PictureBox(); PictureBox threeStar = new PictureBox(); PictureBox fourStar = new PictureBox(); PictureBox fiveStar = new PictureBox(); oneStar.Size = new Size(25, 26); twoStar.Size = new Size(25, 26); threeStar.Size = new Size(25, 26); fourStar.Size = new Size(25, 26); fiveStar.Size = new Size(25, 26); oneStar.Margin = new Padding(3); twoStar.Margin = new Padding(3); threeStar.Margin = new Padding(3); fourStar.Margin = new Padding(3); fiveStar.Margin = new Padding(3); oneStar.Padding = new Padding(0); twoStar.Padding = new Padding(0); threeStar.Padding = new Padding(0); fourStar.Padding = new Padding(0); fiveStar.Padding = new Padding(0); oneStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); twoStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); threeStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); fourStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); fiveStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); stars = new List <PictureBox>(); stars.Add(oneStar); stars.Add(twoStar); stars.Add(threeStar); stars.Add(fourStar); stars.Add(fiveStar); //Event listeners ratings.MouseLeave += new EventHandler(ratings_MouseLeave); oneStar.MouseEnter += new EventHandler(oneStar_MouseEnter); twoStar.MouseEnter += new EventHandler(twoStar_MouseEnter); threeStar.MouseEnter += new EventHandler(threeStar_MouseEnter); fourStar.MouseEnter += new EventHandler(fourStar_MouseEnter); fiveStar.MouseEnter += new EventHandler(fiveStar_MouseEnter); oneStar.MouseClick += new MouseEventHandler(oneStar_MouseClick); twoStar.MouseClick += new MouseEventHandler(twoStar_MouseClick); threeStar.MouseClick += new MouseEventHandler(threeStar_MouseClick); fourStar.MouseClick += new MouseEventHandler(fourStar_MouseClick); fiveStar.MouseClick += new MouseEventHandler(fiveStar_MouseClick); Button watchlist = new Button(); if (helper.inWatchList(theMovie.getMID(), UID)) //If in watchlist { watchlist.Text = "Remove from Watchlist"; } else { watchlist.Text = "Add to Watchlist"; } watchlist.MouseClick += new MouseEventHandler(watchlist_MouseClick); //watchlist.AutoSize = true; watchlist.Width = 150; watchlist.FlatStyle = FlatStyle.Flat; //watchlist.Dock = DockStyle.Fill; ratings.Controls.Add(oneStar); ratings.Controls.Add(twoStar); ratings.Controls.Add(threeStar); ratings.Controls.Add(fourStar); ratings.Controls.Add(fiveStar); ratings.Controls.Add(watchlist); changeAllStars(movieRating); leftCol.Controls.Add(ratings); //add ratings pnlTopTable.Controls.Add(leftCol, 0, 0); //RIGHT column contents FlowLayoutPanel pnlMovieDetails = new FlowLayoutPanel(); pnlMovieDetails.Margin = new Padding(0, 25, 0, 0); pnlMovieDetails.Dock = DockStyle.Fill; //pnlMovieDetails.Width = 400; //pnlMovieDetails.Width = pnlMovieInfo.Width; //pnlMovieDetails.Height = pnlMovieInfo.Height / 2; pnlMovieDetails.FlowDirection = FlowDirection.TopDown; //Create Tab Info TabControl details = new TabControl(); details.Width = 600; details.Height = 285; //details.Dock = DockStyle.Fill; //Create tab pages TabPage pgActors = new TabPage("Actors"); //Fill info into the tab page //Actors Tab FlowLayoutPanel flowActors = new FlowLayoutPanel(); flowActors.FlowDirection = FlowDirection.TopDown; pgActors.Controls.Add(flowActors); flowActors.Dock = DockStyle.Fill; List <Actor> actorList = theMovie.getActors(); for (int i = 0; i < actorList.Count; i++) { Label lblActor = new Label(); lblActor.Text = actorList[i].getName(); flowActors.Controls.Add(lblActor); } //Info Tab TabPage pgInfo = new TabPage("Info"); //FlowLayoutPanel flowInfo = new FlowLayoutPanel(); //flowInfo.FlowDirection = FlowDirection.TopDown; //pgInfo.Controls.Add(flowInfo); //flowInfo.Dock = DockStyle.Fill; Label lblInfo = new Label(); lblInfo.Dock = DockStyle.Fill; lblInfo.Text = theMovie.getInfo(); pgInfo.Controls.Add(lblInfo); //flowInfo.Controls.Add(lblInfo); //Add tab pages details.TabPages.Add(pgActors); details.TabPages.Add(pgInfo); pnlMovieDetails.Controls.Add(details); //add right column contents to table pnlTopTable.Controls.Add(pnlMovieDetails, 1, 0); //End of Table Panel //Below add another FlowPanel for Reviews /* * FlowLayoutPanel pnlReviewHolder = new FlowLayoutPanel(); * pnlReviewHolder.FlowDirection = FlowDirection.TopDown; * * FlowLayoutPanel pnlReviewHeader = new FlowLayoutPanel(); * Label lblReview = new Label(); * lblReview.Text = "REVIEWS"; * Button toggle = new Button(); * toggle.Text = "Show/Hide"; * toggle.FlatStyle = FlatStyle.Flat; * /////////////////////////// REMEMBER TO ADD BUTTON LISTENER * pnlReviewHeader.Controls.Add(lblReview); * pnlReviewHeader.Controls.Add(toggle); * //Add stuff to the review holder panel * pnlReviewHolder.Controls.Add(pnlReviewHeader); */ //Add the two items to the Movie Info Panel pnlMovieInfo.Controls.Add(pnlTopTable); // pnlMovieInfo.Controls.Add(pnlReviewHolder); //pnlMovieInfo.Controls.Add(pnlTopTable, 0, 0); //pnlMovieInfo.Controls.Add(pnlReviewHolder, 0, 1); //Add everything to the Content Panel pnlContent.Controls.Add(pnlMovieInfo); }
public void changeToMoviePage(Movie theMovie) { currMovie = theMovie; DBConnect helper = new DBConnect(); movieRating = (int)helper.getUserRating(theMovie.getMID(), UID); // MessageBox.Show("Rating:" + movieRating.ToString()); userRated = true; if (movieRating == -1) { userRated = false; movieRating = (int)helper.AverageRating(theMovie.getMID()); } addBreadrumbs(this, theMovie.getTitle()); lblLocation.Text = theMovie.getTitle(); pnlContent.Controls.Clear(); //build new big panel pnlMovieInfo = new FlowLayoutPanel(); //pnlMovieInfo = new TableLayoutPanel(); //pnlMovieInfo.Anchor = AnchorStyles.Top; //pnlMovieInfo.Anchor = AnchorStyles.Bottom; //pnlMovieInfo.Anchor = AnchorStyles.Left; //pnlMovieInfo.Anchor = AnchorStyles.Right; //pnlMovieInfo.RowCount = 2; // pnlMovieInfo.ColumnCount = 1; pnlMovieInfo.BackColor = Color.SteelBlue; pnlMovieInfo.Dock = DockStyle.Fill; // this.pnlMovieInfo.RowStyles[0].Height = 50F; //this.pnlMovieInfo.RowStyles[1].Height = 50F; //this.pnlMovieInfo.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); pnlMovieInfo.FlowDirection = FlowDirection.TopDown; //Add Table panel to divide Movie thumbnail with info TableLayoutPanel pnlTopTable = new TableLayoutPanel(); //pnlTopTable.AutoSize = true; pnlTopTable.RowCount = 1; pnlTopTable.ColumnCount = 2; pnlTopTable.Padding = new Padding(0); pnlTopTable.Width = 1000; pnlTopTable.Height = 360; //pnlTopTable.Dock = DockStyle.Fill; pnlTopTable.BackColor = Color.SteelBlue; //Add left column contents FlowLayoutPanel leftCol = new FlowLayoutPanel(); leftCol.Padding = new Padding(0); leftCol.Dock = DockStyle.Fill; leftCol.FlowDirection = FlowDirection.TopDown; leftCol.Controls.Add(theMovie.buildThumbnailPanel()); //add thumbnails //Create area for ratings FlowLayoutPanel ratings = new FlowLayoutPanel(); ratings.Margin = new Padding(22, 0, 0, 0); //ratings.Height = 550; //ratings.Width = 550; ratings.FlowDirection = FlowDirection.LeftToRight; ratings.Padding = new Padding(0); ratings.BackColor = Color.SteelBlue; PictureBox oneStar = new PictureBox(); PictureBox twoStar = new PictureBox(); PictureBox threeStar = new PictureBox(); PictureBox fourStar = new PictureBox(); PictureBox fiveStar = new PictureBox(); oneStar.Size = new Size(25, 26); twoStar.Size = new Size(25, 26); threeStar.Size = new Size(25, 26); fourStar.Size = new Size(25, 26); fiveStar.Size = new Size(25, 26); oneStar.Margin = new Padding(3); twoStar.Margin = new Padding(3); threeStar.Margin = new Padding(3); fourStar.Margin = new Padding(3); fiveStar.Margin = new Padding(3); oneStar.Padding = new Padding(0); twoStar.Padding = new Padding(0); threeStar.Padding = new Padding(0); fourStar.Padding = new Padding(0); fiveStar.Padding = new Padding(0); oneStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); twoStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); threeStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); fourStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); fiveStar.ImageLocation = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Graphics/blankstar.png"); stars = new List<PictureBox>(); stars.Add(oneStar); stars.Add(twoStar); stars.Add(threeStar); stars.Add(fourStar); stars.Add(fiveStar); //Event listeners ratings.MouseLeave += new EventHandler(ratings_MouseLeave); oneStar.MouseEnter += new EventHandler(oneStar_MouseEnter); twoStar.MouseEnter += new EventHandler(twoStar_MouseEnter); threeStar.MouseEnter += new EventHandler(threeStar_MouseEnter); fourStar.MouseEnter += new EventHandler(fourStar_MouseEnter); fiveStar.MouseEnter += new EventHandler(fiveStar_MouseEnter); oneStar.MouseClick += new MouseEventHandler(oneStar_MouseClick); twoStar.MouseClick += new MouseEventHandler(twoStar_MouseClick); threeStar.MouseClick += new MouseEventHandler(threeStar_MouseClick); fourStar.MouseClick += new MouseEventHandler(fourStar_MouseClick); fiveStar.MouseClick += new MouseEventHandler(fiveStar_MouseClick); Button watchlist = new Button(); if (helper.inWatchList(theMovie.getMID(),UID))//If in watchlist { watchlist.Text = "Remove from Watchlist"; } else { watchlist.Text = "Add to Watchlist"; } watchlist.MouseClick += new MouseEventHandler(watchlist_MouseClick); //watchlist.AutoSize = true; watchlist.Width = 150; watchlist.FlatStyle = FlatStyle.Flat; //watchlist.Dock = DockStyle.Fill; ratings.Controls.Add(oneStar); ratings.Controls.Add(twoStar); ratings.Controls.Add(threeStar); ratings.Controls.Add(fourStar); ratings.Controls.Add(fiveStar); ratings.Controls.Add(watchlist); changeAllStars(movieRating); leftCol.Controls.Add(ratings); //add ratings pnlTopTable.Controls.Add(leftCol, 0, 0); //RIGHT column contents FlowLayoutPanel pnlMovieDetails = new FlowLayoutPanel(); pnlMovieDetails.Margin = new Padding(0, 25, 0, 0); pnlMovieDetails.Dock = DockStyle.Fill; //pnlMovieDetails.Width = 400; //pnlMovieDetails.Width = pnlMovieInfo.Width; //pnlMovieDetails.Height = pnlMovieInfo.Height / 2; pnlMovieDetails.FlowDirection = FlowDirection.TopDown; //Create Tab Info TabControl details = new TabControl(); details.Width = 600; details.Height = 285; //details.Dock = DockStyle.Fill; //Create tab pages TabPage pgActors = new TabPage("Actors"); //Fill info into the tab page //Actors Tab FlowLayoutPanel flowActors = new FlowLayoutPanel(); flowActors.FlowDirection = FlowDirection.TopDown; pgActors.Controls.Add(flowActors); flowActors.Dock = DockStyle.Fill; List<Actor> actorList = theMovie.getActors(); for (int i = 0; i < actorList.Count; i++) { Label lblActor = new Label(); lblActor.Text = actorList[i].getName(); flowActors.Controls.Add(lblActor); } //Info Tab TabPage pgInfo = new TabPage("Info"); //FlowLayoutPanel flowInfo = new FlowLayoutPanel(); //flowInfo.FlowDirection = FlowDirection.TopDown; //pgInfo.Controls.Add(flowInfo); //flowInfo.Dock = DockStyle.Fill; Label lblInfo = new Label(); lblInfo.Dock = DockStyle.Fill; lblInfo.Text = theMovie.getInfo(); pgInfo.Controls.Add(lblInfo); //flowInfo.Controls.Add(lblInfo); //Add tab pages details.TabPages.Add(pgActors); details.TabPages.Add(pgInfo); pnlMovieDetails.Controls.Add(details); //add right column contents to table pnlTopTable.Controls.Add(pnlMovieDetails, 1, 0); //End of Table Panel //Below add another FlowPanel for Reviews /* FlowLayoutPanel pnlReviewHolder = new FlowLayoutPanel(); pnlReviewHolder.FlowDirection = FlowDirection.TopDown; FlowLayoutPanel pnlReviewHeader = new FlowLayoutPanel(); Label lblReview = new Label(); lblReview.Text = "REVIEWS"; Button toggle = new Button(); toggle.Text = "Show/Hide"; toggle.FlatStyle = FlatStyle.Flat; /////////////////////////// REMEMBER TO ADD BUTTON LISTENER pnlReviewHeader.Controls.Add(lblReview); pnlReviewHeader.Controls.Add(toggle); //Add stuff to the review holder panel pnlReviewHolder.Controls.Add(pnlReviewHeader); */ //Add the two items to the Movie Info Panel pnlMovieInfo.Controls.Add(pnlTopTable); // pnlMovieInfo.Controls.Add(pnlReviewHolder); //pnlMovieInfo.Controls.Add(pnlTopTable, 0, 0); //pnlMovieInfo.Controls.Add(pnlReviewHolder, 0, 1); //Add everything to the Content Panel pnlContent.Controls.Add(pnlMovieInfo); }