diff --git a/Test_Merge/Form1.Designer.cs b/Test_Merge/Form1.Designer.cs index 282205e..30e3389 100644 --- a/Test_Merge/Form1.Designer.cs +++ b/Test_Merge/Form1.Designer.cs @@ -44,23 +44,23 @@ this.gpbxOvertakes = new System.Windows.Forms.GroupBox(); this.lsbOvertakes = new System.Windows.Forms.ListBox(); this.gpbxDriverInfos = new System.Windows.Forms.GroupBox(); - this.lblCurrentDriverPosition = new System.Windows.Forms.Label(); this.lblCurrentDriverDRS = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.lblCurrentDriverTyreAge = new System.Windows.Forms.Label(); this.lblCurrentDriverTyreType = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.lblCurrentDriverPosition = new System.Windows.Forms.Label(); this.lblCurrentDriverGapToLeader = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.lblCurrentDriverTyreAge = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.pnlCurrentDriverLapsHistory = new System.Windows.Forms.Panel(); this.lblCurrentDriverLapTime = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.lblCurrentDriverName = new System.Windows.Forms.Label(); this.gpbxLapTimes = new System.Windows.Forms.GroupBox(); + this.pnlSlowest = new System.Windows.Forms.Panel(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.pnlSlowest = new System.Windows.Forms.Panel(); this.pnlFastest = new System.Windows.Forms.Panel(); this.gpbxBattles = new System.Windows.Forms.GroupBox(); this.pnlBattles = new System.Windows.Forms.Panel(); @@ -215,7 +215,6 @@ // // gpbxRanking // - this.gpbxRanking.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.gpbxRanking.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(79)))), ((int)(((byte)(79)))), ((int)(((byte)(79))))); this.gpbxRanking.Controls.Add(this.pnlLiveRanking); this.gpbxRanking.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252))))); @@ -293,16 +292,6 @@ this.gpbxDriverInfos.Text = "Driver infos"; this.gpbxDriverInfos.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders); // - // lblCurrentDriverPosition - // - this.lblCurrentDriverPosition.AutoSize = true; - this.lblCurrentDriverPosition.Font = new System.Drawing.Font("Microsoft YaHei UI", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblCurrentDriverPosition.Location = new System.Drawing.Point(216, 21); - this.lblCurrentDriverPosition.Name = "lblCurrentDriverPosition"; - this.lblCurrentDriverPosition.Size = new System.Drawing.Size(43, 36); - this.lblCurrentDriverPosition.TabIndex = 12; - this.lblCurrentDriverPosition.Text = "-1"; - // // lblCurrentDriverDRS // this.lblCurrentDriverDRS.AutoSize = true; @@ -313,26 +302,6 @@ this.lblCurrentDriverDRS.TabIndex = 11; this.lblCurrentDriverDRS.Text = "No"; // - // label11 - // - this.label11.AutoSize = true; - this.label11.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); - this.label11.Location = new System.Drawing.Point(7, 175); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(52, 27); - this.label11.TabIndex = 10; - this.label11.Text = "DRS"; - // - // lblCurrentDriverTyreAge - // - this.lblCurrentDriverTyreAge.AutoSize = true; - this.lblCurrentDriverTyreAge.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); - this.lblCurrentDriverTyreAge.Location = new System.Drawing.Point(191, 138); - this.lblCurrentDriverTyreAge.Name = "lblCurrentDriverTyreAge"; - this.lblCurrentDriverTyreAge.Size = new System.Drawing.Size(85, 27); - this.lblCurrentDriverTyreAge.TabIndex = 9; - this.lblCurrentDriverTyreAge.Text = "10 Laps"; - // // lblCurrentDriverTyreType // this.lblCurrentDriverTyreType.AutoSize = true; @@ -343,15 +312,25 @@ this.lblCurrentDriverTyreType.TabIndex = 8; this.lblCurrentDriverTyreType.Text = "Undefined"; // - // label8 + // label11 // - this.label8.AutoSize = true; - this.label8.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); - this.label8.Location = new System.Drawing.Point(7, 138); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(58, 27); - this.label8.TabIndex = 7; - this.label8.Text = "Tyre:"; + this.label11.AutoSize = true; + this.label11.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.label11.Location = new System.Drawing.Point(7, 175); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(52, 27); + this.label11.TabIndex = 10; + this.label11.Text = "DRS"; + // + // lblCurrentDriverPosition + // + this.lblCurrentDriverPosition.AutoSize = true; + this.lblCurrentDriverPosition.Font = new System.Drawing.Font("Microsoft YaHei UI", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblCurrentDriverPosition.Location = new System.Drawing.Point(216, 21); + this.lblCurrentDriverPosition.Name = "lblCurrentDriverPosition"; + this.lblCurrentDriverPosition.Size = new System.Drawing.Size(43, 36); + this.lblCurrentDriverPosition.TabIndex = 12; + this.lblCurrentDriverPosition.Text = "-1"; // // lblCurrentDriverGapToLeader // @@ -373,6 +352,26 @@ this.label5.TabIndex = 5; this.label5.Text = "Gap to leader :"; // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.label8.Location = new System.Drawing.Point(7, 138); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(58, 27); + this.label8.TabIndex = 7; + this.label8.Text = "Tyre:"; + // + // lblCurrentDriverTyreAge + // + this.lblCurrentDriverTyreAge.AutoSize = true; + this.lblCurrentDriverTyreAge.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.lblCurrentDriverTyreAge.Location = new System.Drawing.Point(191, 138); + this.lblCurrentDriverTyreAge.Name = "lblCurrentDriverTyreAge"; + this.lblCurrentDriverTyreAge.Size = new System.Drawing.Size(85, 27); + this.lblCurrentDriverTyreAge.TabIndex = 9; + this.lblCurrentDriverTyreAge.Text = "10 Laps"; + // // label6 // this.label6.AutoSize = true; @@ -440,6 +439,15 @@ this.gpbxLapTimes.Text = "Last five laps"; this.gpbxLapTimes.Paint += new System.Windows.Forms.PaintEventHandler(this.removeBorders); // + // pnlSlowest + // + this.pnlSlowest.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); + this.pnlSlowest.Location = new System.Drawing.Point(280, 39); + this.pnlSlowest.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.pnlSlowest.Name = "pnlSlowest"; + this.pnlSlowest.Size = new System.Drawing.Size(264, 228); + this.pnlSlowest.TabIndex = 1; + // // label3 // this.label3.AutoSize = true; @@ -458,15 +466,6 @@ this.label2.TabIndex = 2; this.label2.Text = "Fastests"; // - // pnlSlowest - // - this.pnlSlowest.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); - this.pnlSlowest.Location = new System.Drawing.Point(280, 39); - this.pnlSlowest.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.pnlSlowest.Name = "pnlSlowest"; - this.pnlSlowest.Size = new System.Drawing.Size(264, 228); - this.pnlSlowest.TabIndex = 1; - // // pnlFastest // this.pnlFastest.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(51)))), ((int)(((byte)(51))))); @@ -506,7 +505,7 @@ this.label9.BackColor = System.Drawing.Color.Transparent; this.label9.Font = new System.Drawing.Font("Microsoft YaHei UI", 19.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(252)))), ((int)(((byte)(252))))); - this.label9.Location = new System.Drawing.Point(30, 6); + this.label9.Location = new System.Drawing.Point(33, 9); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(221, 43); this.label9.TabIndex = 12; @@ -527,6 +526,7 @@ this.Controls.Add(this.gpbxControls); this.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.MinimumSize = new System.Drawing.Size(1182, 808); this.Name = "Main"; this.Text = "Track Trends"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); diff --git a/Test_Merge/Form1.cs b/Test_Merge/Form1.cs index 5822b47..a6626f0 100644 --- a/Test_Merge/Form1.cs +++ b/Test_Merge/Form1.cs @@ -24,6 +24,25 @@ namespace Test_Merge string ConfigFile = ""; string GpUrl = ""; + //For the responsive content + + Size oldSize = new Size(); + Size oldRankingSize = new Size(); + Size oldLapTimesSize = new Size(); + Size oldBattles = new Size(); + + Size oldPnlBattles = new Size(); + Size oldPnlRankings = new Size(); + Size oldPnlFastest = new Size(); + Size oldPnlSlowest = new Size(); + + Point oldRankingPosition = new Point(); + Point oldBattlePosition = new Point(); + Point oldDriverInfoPosition = new Point(); + + Point olPnlFastestPosition = new Point(); + Point oldPnlSlowestPosition = new Point(); + public Main() { InitializeComponent(); @@ -48,6 +67,7 @@ namespace Test_Merge Settings settingsForm = new Settings(); settingsForm.ShowDialog(); + RefreshUI(); //MessageBox.Show(settingsForm.GrandPrixUrl + Environment.NewLine + settingsForm.GrandPrixName + Environment.NewLine + settingsForm.GrandPrixYear); if (settingsForm.GrandPrixUrl != "" && settingsForm.SelectedConfigFile != "") { @@ -76,6 +96,23 @@ namespace Test_Merge tbxGpUrl.Text = GpUrl; + oldSize = this.Size; + oldRankingSize = gpbxRanking.Size; + oldLapTimesSize = gpbxLapTimes.Size; + oldBattles = gpbxBattles.Size; + + oldPnlRankings = pnlLiveRanking.Size; + oldPnlBattles = pnlBattles.Size; + oldPnlFastest = pnlFastest.Size; + oldPnlSlowest = pnlSlowest.Size; + + oldRankingPosition = gpbxRanking.Location; + oldBattlePosition = gpbxBattles.Location; + oldDriverInfoPosition = gpbxDriverInfos.Location; + + olPnlFastestPosition = pnlFastest.Location; + oldPnlSlowestPosition = pnlSlowest.Location; + tip1.SetToolTip(btnResetEmulator, "Starts or restarts the emulator. You need to start this to use the app"); tip1.SetToolTip(btnSettings, "Opens the configuration menu"); tip1.SetToolTip(tbxGpUrl, "Insert the URL of the Grand Prix you want to track. Dont forget the \"?action=play\" at the end"); @@ -310,7 +347,32 @@ namespace Test_Merge private void Main_Resize(object sender, EventArgs e) { + int xDiff = this.Width - oldSize.Width; + int yDiff = this.Height - oldSize.Height; + int padding = 10; + //This will take half the newly created space + gpbxRanking.Size = new Size(oldRankingSize.Width + xDiff / 2, oldRankingSize.Height + yDiff); + gpbxRanking.Location = new Point(oldRankingPosition.X + xDiff / 2, gpbxRanking.Location.Y); + //Will take half the new height and half the new height + gpbxLapTimes.Size = new Size(oldLapTimesSize.Width + xDiff / 2, oldLapTimesSize.Height + yDiff / 2); + //Will take half the new height and half the new width + gpbxBattles.Size = new Size(oldBattles.Width + xDiff / 2, oldBattles.Height + yDiff / 2); + gpbxBattles.Location = new Point(gpbxBattles.Location.X, oldBattlePosition.Y + yDiff / 2); + //The infos wont change width but will need to be centerd + Point startOfZone = new Point(gpbxOvertakes.Width + gpbxOvertakes.Location.X, gpbxOvertakes.Location.Y); + Point endOfZone = new Point(gpbxRanking.Location.X, gpbxOvertakes.Location.Y); + int totalWidth = endOfZone.X - startOfZone.X; + gpbxDriverInfos.Location = new Point(startOfZone.X + (totalWidth / 2 - gpbxDriverInfos.Width / 2), oldDriverInfoPosition.Y + yDiff); + //Now resizing internals + pnlFastest.Size = new Size(oldPnlFastest.Width + xDiff / 4,oldPnlFastest.Height + yDiff / 4); + pnlFastest.Location = new Point(olPnlFastestPosition.X,olPnlFastestPosition.Y + yDiff / 4); + pnlSlowest.Size = new Size(oldPnlSlowest.Width + xDiff / 4, oldPnlSlowest.Height + yDiff / 4); + pnlSlowest.Location = new Point(oldPnlSlowestPosition.X + xDiff / 4, oldPnlSlowestPosition.Y + yDiff / 4); + + pnlBattles.Size = new Size(oldPnlBattles.Width + xDiff / 2,oldPnlBattles.Height + yDiff / 2); + + pnlLiveRanking.Size = new Size(oldPnlRankings.Width + xDiff / 2,oldPnlRankings.Height + yDiff); } } } diff --git a/Test_Merge/Settings.cs b/Test_Merge/Settings.cs index eac21b6..9d62ef2 100644 --- a/Test_Merge/Settings.cs +++ b/Test_Merge/Settings.cs @@ -67,7 +67,6 @@ namespace Test_Merge } private void RefreshUI() { - lsbDrivers.DataSource = null; lsbDrivers.DataSource = DriverList;