From f3d40ef94e57d1ed21aa60a79aea108ba61b10e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Priskin?= Date: Fri, 20 Jan 2023 17:29:03 +0100 Subject: [PATCH] =?UTF-8?q?K=C3=A9sz=20a=20feladat=20megold=C3=A1sa.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Merkozesek/StatisztikaForm.Designer.cs | 25 ++++++++++++++++++++++++- Merkozesek/StatisztikaForm.cs | 19 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Merkozesek/StatisztikaForm.Designer.cs b/Merkozesek/StatisztikaForm.Designer.cs index 4e89af1..f64c006 100644 --- a/Merkozesek/StatisztikaForm.Designer.cs +++ b/Merkozesek/StatisztikaForm.Designer.cs @@ -41,6 +41,7 @@ namespace Merkozesek this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.button2 = new System.Windows.Forms.Button(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -139,7 +140,7 @@ namespace Merkozesek // // button2 // - this.button2.Location = new System.Drawing.Point(204, 405); + this.button2.Location = new System.Drawing.Point(204, 421); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 11; @@ -147,11 +148,32 @@ namespace Merkozesek this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoScroll = true; + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F)); + this.tableLayoutPanel1.Location = new System.Drawing.Point(24, 242); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 8; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(375, 157); + this.tableLayoutPanel1.TabIndex = 12; + // // StatisztikaForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(483, 456); + this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.button2); this.Controls.Add(this.label5); this.Controls.Add(this.textBox4); @@ -186,5 +208,6 @@ namespace Merkozesek private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Button button2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; } } \ No newline at end of file diff --git a/Merkozesek/StatisztikaForm.cs b/Merkozesek/StatisztikaForm.cs index c66336a..7f46798 100644 --- a/Merkozesek/StatisztikaForm.cs +++ b/Merkozesek/StatisztikaForm.cs @@ -39,12 +39,31 @@ namespace Merkozesek int hgy = 0; int vgy = 0; + int golszumma = 0; stlista.ForEach(sm => { if (sm.HazaiRugott > sm.VendegRugott) hgy++; if (sm.HazaiRugott < sm.VendegRugott) vgy++; + golszumma += (sm.HazaiRugott + sm.VendegRugott); }); textBox3.Text = hgy.ToString(); textBox4.Text = vgy.ToString(); + + foreach (var sm in stlista) + { + double smgol = (sm.HazaiRugott + sm.VendegRugott); + double arany = (smgol / golszumma) * 100; + Label cscimke = new Label(); + cscimke.AutoSize = true; + cscimke.Text = sm.ToString(); + tableLayoutPanel1.Controls.Add(cscimke); + Label acimke = new Label(); + acimke.AutoSize = true; + acimke.Text = arany.ToString("F2")+" %"; + tableLayoutPanel1.Controls.Add(acimke); + + + } + } catch (Exception) {