Nya ResultatRutor

This commit is contained in:
2022-06-30 23:23:16 +02:00
parent 8b722b024e
commit d39a372b3a
2 changed files with 55 additions and 10 deletions

View File

@ -37,6 +37,8 @@
this.btnDiceTmpl6 = new System.Windows.Forms.Button(); this.btnDiceTmpl6 = new System.Windows.Forms.Button();
this.btnDiceTmpl5 = new System.Windows.Forms.Button(); this.btnDiceTmpl5 = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button();
this.txtMaxValue = new System.Windows.Forms.TextBox();
this.txtChosenValue = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
@ -135,11 +137,31 @@
this.btnClose.UseVisualStyleBackColor = true; this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click); this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// //
// txtMaxValue
//
this.txtMaxValue.Location = new System.Drawing.Point(669, 82);
this.txtMaxValue.Multiline = true;
this.txtMaxValue.Name = "txtMaxValue";
this.txtMaxValue.Size = new System.Drawing.Size(42, 44);
this.txtMaxValue.TabIndex = 9;
this.txtMaxValue.Visible = false;
//
// txtChosenValue
//
this.txtChosenValue.Location = new System.Drawing.Point(669, 126);
this.txtChosenValue.Multiline = true;
this.txtChosenValue.Name = "txtChosenValue";
this.txtChosenValue.Size = new System.Drawing.Size(42, 44);
this.txtChosenValue.TabIndex = 10;
this.txtChosenValue.Visible = false;
//
// frmPersonRound // frmPersonRound
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450); this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.txtChosenValue);
this.Controls.Add(this.txtMaxValue);
this.Controls.Add(this.btnClose); this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnDiceTmpl6); this.Controls.Add(this.btnDiceTmpl6);
this.Controls.Add(this.btnDiceTmpl5); this.Controls.Add(this.btnDiceTmpl5);
@ -168,5 +190,7 @@
private Button btnDiceTmpl6; private Button btnDiceTmpl6;
private Button btnDiceTmpl5; private Button btnDiceTmpl5;
private Button btnClose; private Button btnClose;
private TextBox txtMaxValue;
private TextBox txtChosenValue;
} }
} }

View File

@ -35,7 +35,7 @@ namespace WinGreed
{ {
x = 0; x = 0;
y = y + btnDiceTmpl1.Height+5; y = y + btnDiceTmpl1.Height + 5;
var no = 0; var no = 0;
var result = _ht.Throw(); var result = _ht.Throw();
@ -110,7 +110,7 @@ namespace WinGreed
List<int> Numbers = new List<int>(); List<int> Numbers = new List<int>();
foreach (var item in result) foreach (var item in result)
{ {
Numbers.Add(item.Number); Numbers.Add(item.Number);
} }
AnalyseNumbers(Numbers); AnalyseNumbers(Numbers);
@ -134,19 +134,40 @@ namespace WinGreed
} }
} }
} }
AnalyseNumbers(Numbers); AnalyseNumbers(Numbers, false);
} }
} }
private void AnalyseNumbers(List<int> numbers) private void AnalyseNumbers(List<int> numbers, bool before = true)
{ {
if (before)
{
TextBox txt = null;
TextBox txtRes = null;
txt = txtMaxValue.Clone<TextBox>();
txt.Name = $"txtMaxValue{row}";
txt.Location = new Point(x + 350, y);
txt.Visible = true;
this.Controls.Add(txt);
this.Refresh();
txtRes = txtChosenValue.Clone<TextBox>();
txtRes.Name = $"txtChosenValue{row}";
txtRes.Location = new Point(x + 350 + (txtRes.Width + 5), y);
txtRes.Visible = true;
this.Controls.Add(txtRes);
this.Refresh();
}
numbers.ForEach(x => Debug.Write($"{x}, ")); numbers.ForEach(x => Debug.Write($"{x}, "));
Debug.WriteLine(" -"); Debug.WriteLine(" -");
} }
private void btnDiceTmpl_Click(object sender, EventArgs e) private void btnDiceTmpl_Click(object sender, EventArgs e)
{ {
if (((Dice)((Button)sender).Tag).Chosen) { if (((Dice)((Button)sender).Tag).Chosen)
{
((Button)sender).BackColor = Color.Green; ((Button)sender).BackColor = Color.Green;
((Dice)((Button)sender).Tag).Chosen = false; ((Dice)((Button)sender).Tag).Chosen = false;
} }