public Form3() { InitializeComponent(); highscore = new highscore(); //set gamescreen width and height based on the size of your computer screen. double form_width = (double)this.Width; double full_screen_width = (double)Screen.PrimaryScreen.Bounds.Width; double resize_width_factor = full_screen_width / form_width; double form_height = (double)this.Height; double full_screen_height = (double)Screen.PrimaryScreen.Bounds.Height; double resize_height_factor = full_screen_height / form_height; //Send a request to the file called get_highscores_top7.php string response = highscore.SendRequest(highscore.return_phpfile("get_highscores_top7.php")); //set all labels to the highscore values from get_highscores_top7.php if (response != null) { fooArray = response.Split(','); Label[] highscorelabels = new Label[21] { label1, label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12, label13, label14, label15, label16, label17, label18, label19, label20, label21 }; int highscoreresult = fooArray.Length; for (int j = 0; j < highscorelabels.Length; j++) { if (j < highscoreresult) { highscorelabels[j].Text = fooArray[j].ToString(); } else { highscorelabels[j].Text = ""; } //set highscorelabel width and height based on the size of your computer screen and the font on 14. highscorelabels[j].Font = new Font("Arial", 14); (highscorelabels[j]).Width = (int)(highscorelabels[j].Width * resize_width_factor); highscorelabels[j].Height = (int)(highscorelabels[j].Height * resize_height_factor); (highscorelabels[j]).Left = (int)(highscorelabels[j].Location.X * resize_width_factor); highscorelabels[j].Top = (int)(highscorelabels[j].Location.Y * resize_height_factor); } //MessageBox.Show(response, "Hey there!", MessageBoxButtons.OK, MessageBoxIcon.Information); } //set boxes width and height based on the size of your computer screen. boxes = new PictureBox[1] { pictureBox1 }; for (int i = 0; i < boxes.Length; i++) { (boxes[i]).Width = (int)(boxes[i].Width * resize_width_factor); boxes[i].Height = (int)(boxes[i].Height * resize_height_factor); (boxes[i]).Left = (int)(boxes[i].Location.X * resize_width_factor); boxes[i].Top = (int)(boxes[i].Location.Y * resize_height_factor); } }
public Form2(String NameInput) { InitializeComponent(); highscore = new highscore(); stopWatch.Start(); //Make a new solution from the class solution that has to been guess solution = new Solution(); for (int i = 0; i < solution.make_solutions().Length; i++) { Solution1.Tag = solution.make_solutions()[0]; Solution2.Tag = solution.make_solutions()[1]; Solution3.Tag = solution.make_solutions()[2]; Solution4.Tag = solution.make_solutions()[3]; //Solution1.Image = Image.FromFile(solution.return_image(Solution1.Tag.ToString())); //Solution2.Image = Image.FromFile(solution.return_image(Solution2.Tag.ToString())); //Solution3.Image = Image.FromFile(solution.return_image(Solution3.Tag.ToString())); //Solution4.Image = Image.FromFile(solution.return_image(Solution4.Tag.ToString())); } solution_input = new String[] { Solution1.Tag.ToString(), Solution2.Tag.ToString(), Solution3.Tag.ToString(), Solution4.Tag.ToString() }; solution_input2 = new String[] { Solution1.Tag.ToString(), Solution2.Tag.ToString(), Solution3.Tag.ToString(), Solution4.Tag.ToString() }; //Send a request to the file called get_highscores_top3.php string response = highscore.SendRequest(highscore.return_phpfile("get_highscores_top3.php")); current_row = 0; //set all labels to the highscore values from get_highscores_top3.php if (response != null) { fooArray = response.Split(','); Label[] highscorelabels = new Label[9] { label5, label6, label7, label9, label11, label12, label13, label15, label16 }; int highscoreresult = fooArray.Length; for (int j = 0; j < highscorelabels.Length; j++) { if (j < highscoreresult) { highscorelabels[j].Text = fooArray[j].ToString(); } else { highscorelabels[j].Text = ""; } } } else { MessageBox.Show("Geen connectie met php server"); } NameLabel.Text = NameInput; ScoreLabel.Text = score.ToString(); //set gamescreen width and height based on the size of your computer screen. double form_width = (double)this.Width; double full_screen_width = (double)Screen.PrimaryScreen.Bounds.Width; double resize_width_factor = full_screen_width / form_width; double form_height = (double)this.Height; double full_screen_height = (double)Screen.PrimaryScreen.Bounds.Height; double resize_height_factor = full_screen_height / form_height; //set boxes width and height based on the size of your computer screen. boxes = new PictureBox[146] { Color1, Color2, Color3, Color4, Color5, Color6, Color7, Color8, Solution1, Solution2, Solution3, Solution4, Check1, Check2, Check3, Check4, Check5, Check6, Check7, Check8, Check9, Check10, Check11, Check12, Check13, Check14, Check15, Check16, Check17, Check18, Check19, Check20, Check21, Check22, Check23, Check24, Check25, Check26, Check27, Check28, Check29, Check30, Check31, Check32, Check33, Check34, Check35, Check36, Check37, Check38, Check39, Check40, Dot1, Dot2, Dot3, Dot4, Dot5, Dot6, Dot7, Dot8, Dot9, Dot10, Dot11, Dot12, Dot13, Dot14, Dot15, Dot16, Dot17, Dot18, Dot19, Dot20, Dot21, Dot22, Dot23, Dot24, Dot25, Dot26, Dot27, Dot28, Dot29, Dot30, Dot31, Dot32, Dot33, Dot34, Dot35, Dot36, Dot37, Dot38, Dot39, Dot40, CheckRow1, CheckRow2, CheckRow3, CheckRow4, CheckRow5, CheckRow6, CheckRow7, CheckRow8, CheckRow9, CheckRow10, pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16, pictureBox17, pictureBox18, pictureBox19, pictureBox20, pictureBox21, pictureBox22, pictureBox23, pictureBox24, pictureBox25, pictureBox26, pictureBox27, pictureBox28, pictureBox29, pictureBox30, pictureBox31, pictureBox32, pictureBox33, pictureBox34, pictureBox35, pictureBox36, pictureBox37, pictureBox38, pictureBox39, pictureBox40, pictureBox41, pictureBox42, current_color, Game_Highscore, Stop }; for (int i = 0; i < boxes.Length; i++) { (boxes[i]).Width = (int)(boxes[i].Width * resize_width_factor); boxes[i].Height = (int)(boxes[i].Height * resize_height_factor); (boxes[i]).Left = (int)(boxes[i].Location.X * resize_width_factor); boxes[i].Top = (int)(boxes[i].Location.Y * resize_height_factor); } dot_boxes = new PictureBox[] { Dot1, Dot2, Dot3, Dot4, Dot5, Dot6, Dot7, Dot8, Dot9, Dot10, Dot11, Dot12, Dot13, Dot14, Dot15, Dot16, Dot17, Dot18, Dot19, Dot20, Dot21, Dot22, Dot23, Dot24, Dot25, Dot26, Dot27, Dot28, Dot29, Dot30, Dot31, Dot32, Dot33, Dot34, Dot35, Dot36, Dot37, Dot38, Dot39, Dot40 }; dots = new Dot[40] { dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8, dot9, dot10, dot11, dot12, dot13, dot14, dot15, dot16, dot17, dot18, dot19, dot20, dot21, dot22, dot23, dot24, dot25, dot26, dot27, dot28, dot29, dot30, dot31, dot32, dot33, dot34, dot35, dot36, dot37, dot38, dot39, dot40 }; checkrow_boxes = new PictureBox[] { CheckRow1, CheckRow2, CheckRow3, CheckRow4, CheckRow5, CheckRow6, CheckRow7, CheckRow8, CheckRow9, CheckRow10 }; checkdot_boxes = new PictureBox[] { Check1, Check2, Check3, Check4, Check5, Check6, Check7, Check8, Check9, Check10, Check11, Check12, Check13, Check14, Check15, Check16, Check17, Check18, Check19, Check20, Check21, Check22, Check23, Check24, Check25, Check26, Check27, Check28, Check29, Check30, Check31, Check32, Check33, Check34, Check35, Check36, Check37, Check38, Check39, Check40 }; //Set the first 4 dots active. for (int i = 0; i < dots.Length; i++) { dots[i] = new Dot(false); if (i < 4) { dots[i].set_active(); dot_boxes[i].Enabled = true; dot_boxes[i].Click += new System.EventHandler(dot_Turn); } } //Set a new eventhandler for the checkrow. for (int i = 0; i < checkrow_boxes.Length; i++) { checkrow_boxes[i].Click += new System.EventHandler(checkRow_Click); } //Set a new eventhandeler for the color selector. for (int i = 0; i < 8; i++) { boxes[i].Click += new System.EventHandler(colorSelect_Click); } //Change fontsize of title's. label1.Font = new Font("Arial", 20); //Resize the labels based on the size of your computer. Label[] labels = new Label[20] { label1, label2, label4, label5, label6, label7, label8, label9, label10, label11, label12, label13, label14, label15, label16, label17, label18, label19, NameLabel, ScoreLabel }; for (int i = 0; i < labels.Length; i++) { if (labels[i] == label2 || labels[i] == label4 || labels[i] == label5 || labels[i] == label6 || labels[i] == label7 || labels[i] == label8 || labels[i] == label9 || labels[i] == label10 || labels[i] == label11 || labels[i] == label12 || labels[i] == label13 || labels[i] == label14 || labels[i] == label15 || labels[i] == label16 || labels[i] == NameLabel || labels[i] == ScoreLabel) { labels[i].Font = new Font("Arial", 14); } else if (labels[i] == label17 || labels[i] == label18 || labels[i] == label19) { labels[i].Font = new Font("Arial", 15); } (labels[i]).Width = (int)(labels[i].Width * resize_width_factor); labels[i].Height = (int)(labels[i].Height * resize_height_factor); (labels[i]).Left = (int)(labels[i].Location.X * resize_width_factor); labels[i].Top = (int)(labels[i].Location.Y * resize_height_factor); } player = new Player("Paras"); }